Loops/Nested: Difference between revisions
Content added Content deleted
(Applesoft BASIC) |
|||
Line 632: | Line 632: | ||
NEXT row</lang> |
NEXT row</lang> |
||
==={{header|Applesoft BASIC}}=== |
|||
<lang gwbasic> 1 C = 5 |
|||
2 R = 4 |
|||
3 C = C - 1:R = C - 1: DIM A(C,R) |
|||
4 FOR J = 0 TO R: FOR I = 0 TO C:N = N + 1:A(I,J) = N: NEXT I,J |
|||
5 FOR J = 0 TO R: FOR I = 0 TO C:X = INT ( RND (1) * C):Y = INT ( RND (1) * R):N = A(I,J):A(I,J) = A(X,Y):A(X,Y) = N: NEXT I,J |
|||
6 FOR J = 0 TO R |
|||
7 FOR I = 0 TO C |
|||
8 PRINT S$A(I,J);:S$ = " " |
|||
9 IF A(I,J) < > 20 THEN NEXT I,J</lang> |
|||
==={{header|Commodore BASIC}}=== |
==={{header|Commodore BASIC}}=== |
||
We should END gracefully. (The Sinclair example below will produce an error on any Commodore machine.) |
We should END gracefully. (The Sinclair example below will produce an error on any Commodore machine.) |