In kotlin how to decrement value by 2 in for loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In kotlin how to decrement value by 2 in for loop?

I know how to decrement value by 1 in kotlin in for loop but i am confused with decrement by 2

10th Feb 2021, 7:53 AM
Yash Chaudhari
Yash Chaudhari - avatar
3 Answers
+ 4
i -= 2; or i = i -2;
10th Feb 2021, 8:13 AM
JaScript
JaScript - avatar
+ 3
https://code.sololearn.com/cr2Nqb3aIKRu/?ref=app Analyze this code, downTo is used for back ranges and step tell how much step you want to go back! It's simple English, haha! All the best!
10th Feb 2021, 10:23 AM
Abhiyantā
Abhiyantā - avatar
+ 2
i+=-2; Including JaScript dont think theres anymore ways
10th Feb 2021, 8:18 AM
D_Stark
D_Stark - avatar