Posts: 737
Threads: 338
Joined: Jan 2013
Hi,
I want to make cikle when variable is
new DDDRRRUUNNNN[ 20 ];
I want to make cikle from 19 to 0,
Код:
for(new i = 19; i == 0; i --)
But this is not working.
Posts: 385
Threads: 10
Joined: Dec 2013
Reputation:
0
for(new i = 19; i == 0; i --)
what you're doing is:
for( new i = 19; //the variable i has now an integer value of 19;
i == 0; // checking if i is equal to 0, which it isn't because it's 19.
i-- // if i is equal to 0, lower the value with 1.
this will never work, as the variable i, is 19, and it ain't 0, so this will create a never ending loop, because i is always 19, and will never decrease as it only decreases when it's 0.
try this instead:
for( new i = 19; i > 0; i-- )
that checks if i is still above 0, if it is, it'll continue, else it'll stop.