Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // INCREMENT & DRECREMENT
- fun main() {
- // INCREMENT: ++
- for (z in 1..3) {
- println("Planet: $z")
- }
- // Increment: exclude
- for (a in 0..3) {
- println("Exclude: $a")
- } // or
- for (b in 0 until 4) {
- println(" Exclude : $b")
- }
- // Increment: step 2
- for (c in 0..11 step 2) {
- println("Step: $c")
- }
- // DECREMENT: --
- for (d in 5 downTo 0) {
- println(" Decrease: $d")
- }
- // Decrement: step 3
- for (e in 14 downTo 0 step 3) {
- println("Decrease: $e")
- }
- // Decrement: complex
- var f = 10
- while (f <= 100) {
- println(" Multi: $f")
- f *= 2
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment