2017-09-23 10:01:46 +02:00
|
|
|
;Task:
|
2018-06-22 20:57:24 +00:00
|
|
|
Show a loop which prints random numbers (each number newly generated each loop) from 0 to 19 (inclusive).
|
2017-09-23 10:01:46 +02:00
|
|
|
|
2018-06-22 20:57:24 +00:00
|
|
|
If a number is 10, stop the loop after printing it, and do not generate any further numbers.
|
2017-09-23 10:01:46 +02:00
|
|
|
|
2015-02-20 00:35:01 -05:00
|
|
|
Otherwise, generate and print a second random number before restarting the loop.
|
2017-09-23 10:01:46 +02:00
|
|
|
|
2018-06-22 20:57:24 +00:00
|
|
|
If the number 10 is never generated as the first number in a loop, loop forever.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Related tasks:
|
|
|
|
|
* [[Loop over multiple arrays simultaneously]]
|
|
|
|
|
* [[Loops/Break]]
|
|
|
|
|
* [[Loops/Continue]]
|
|
|
|
|
* [[Loops/Do-while]]
|
|
|
|
|
* [[Loops/Downward for]]
|
|
|
|
|
* [[Loops/For]]
|
|
|
|
|
* [[Loops/For with a specified step]]
|
|
|
|
|
* [[Loops/Foreach]]
|
|
|
|
|
* [[Loops/Increment loop index within loop body]]
|
|
|
|
|
* [[Loops/Infinite]]
|
|
|
|
|
* [[Loops/N plus one half]]
|
|
|
|
|
* [[Loops/Nested]]
|
|
|
|
|
* [[Loops/While]]
|
2019-09-12 10:33:56 -07:00
|
|
|
* [[Loops/with multiple ranges]]
|
2017-09-23 10:01:46 +02:00
|
|
|
<br><br>
|