0

Why am i not understanding loop in java loan calculator?

12th Jan 2021, 4:48 PM
Motuncoded
Motuncoded - avatar
3 odpowiedzi
+ 4
Ok, just imagine you have like ```kt print("hello") ``` Which prints 1 times but... What if you want to print it 50 times then here's loops job ```kt var r = 1..50 //range for(x in r) print("hello") /**Int range are collection so it would print hello while it iterrate to the last */ ``` Or ```kt var r = 1 do { r++ print("hello") }while( r < 51 ) ``` So loops are just method which returns command repeatedly based on the size of an array, list or collection good luck ;)
12th Jan 2021, 5:10 PM
Ananiya Jemberu
Ananiya Jemberu - avatar