(loopindex%2=0 ? dir : -dir)*loopindex
the % means modulo, or the remainder after dividing, so loopindex % 2 will be either 1 (if loopindex is odd) or 0 (if even)
the rest is an "if then else" statement
if the statement "loopindex%2=0" is true, then return what is in "dir"
if it is not true, it will return -dir
then the result is multiplied by loopindex
I haven't looked at Dop's sample yet, but was just starting to have fun with yours! :)