I want to accomplish this in coffeescript:
for (i = 0, i < count, i++) {
doSomething();
} // count is a number
But it is always handled as an array.
Is there way to prevent this? I have tried a while loop, but it didn´t work out for me.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First of all, you want to implement this:
in CoffeeScript, not
for(i = 0, ...).There’s an example of this sort of thing right in the documentation:
and the JavaScript version:
So you just want to use this:
or
Note the the range starts at 1 so that
[1..count]gives youcountiterations.