Android Question count down (For)

alirezahassan

Active Member
Licensed User
Longtime User
hi all,
I have a (For). I want to reverse the number.
For example in C language:[CODE lang="c" title="C"]for(int i = 10; i>=0; i--)[/CODE]
i use
B4X:
for i = 10 to 0
next
but it doesn't work. what should i do?
 
Last edited:
What exactly do you want to do ?
If you want to go from 10 down to 0, therefor, the Step MUST be negative: For i = 10 To 0 Step -3
If you want to go from 0 to 10 the Step must be positive: For i = 0 To 10 Step 3
If no Step is given, it is 1 by default.
If you want a Steop of -1 you must write it.
 
Upvote 0
Maybe the fact if you make the Step +3 you get a syntax error, obviously it doesn't like the + sign
If you really want to use a plus sign you must write Step 0+3
 
Upvote 0
Back
Top