Keeps saying that there is an unexpected if, but nothing I change is accepted.
addAnimation : (anim) ->
if anim.time > @animations[@animations.length - 1]
@animations.push(anim)
else if anim.time < @animations[0]
@animations.unshift(anim)
else
for index in [[email protected]]
if anim.time > @animations[index-1].time
and anim.time < @animations[index]
@animations.splice(index, 0, anim)
break
All the spacing is as correct as possible. I use 4 for all indentation and there is no trailing whitespace. Have I misunderstood something about the syntax. Btw, this is supposed to be a simple insertion sort.