Loops/Break: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 799: | Line 799: | ||
==={{header|bootBASIC}}=== |
==={{header|bootBASIC}}=== |
||
In bootBASIC, the rnd statement returns an unsigned integer between 0 and 255. 255 divided by 19 gives us 13 without the fraction part, so 13 is the number to divide the random number by to get a range of 0 to 19. All division is integer division. |
|||
<syntaxhighlight lang="BASIC"> |
|||
10 a=rnd/13 |
|||
20 print a ; |
|||
30 if a-10 goto 50 |
|||
40 goto 100 |
|||
50 a=rnd/13 |
|||
55 print ", "; |
|||
60 print a |
|||
70 goto 10 |
|||
100 print |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
13, 19 |
|||
11, 14 |
|||
18, 4 |
|||
17, 0 |
|||
12, 15 |
|||
0, 13 |
|||
7, 19 |
|||
2, 7 |
|||
1, 3 |
|||
6, 18 |
|||
13, 6 |
|||
9, 10 |
|||
4, 7 |
|||
15, 7 |
|||
10 |
|||
</pre> |
|||
==={{header|Commodore BASIC}}=== |
==={{header|Commodore BASIC}}=== |