How can I write a for loop with multiple conditions?
Intended Javascript:
for(k=1; k < 120 && myThing.someValue > 1234; k++){
myThing.action();
}
js2coffee.org indicates that I should use a while loop:
k = 1
while k < 120 and myThing.someValue > 1234
myThing.action()
k++
but this ends up compiling back to a while loop in javascript.
Is there a way to write coffescript to compile to my intended javascript and include extra conditions in the for loop itself?
If the answer to that question is false, then what would be the nicest way to get the same functionality with coffeescript?
My best while loop solution so far is
k = 1
myThing.action() while k++ < 120 and myThing.someValue > 1234
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…