Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
category:
- Loop modifiers
from: http://rosettacode.org/wiki/Loops/Continue
note: Iteration

View file

@ -0,0 +1,28 @@
;Task:
Show the following output using one loop.
1, 2, 3, 4, 5
6, 7, 8, 9, 10
Try to achieve the result by forcing the next iteration within the loop
upon a specific condition, if your language allows it.
;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]]
*   [[Loops/with multiple ranges]]
*   [[Loops/Wrong ranges]]
<br><br>

View file

@ -0,0 +1,5 @@
L(i) 1..10
I i % 5 == 0
print(i)
L.continue
print(i, end' , )

View file

@ -0,0 +1,32 @@
* Loops/Continue 12/08/2015
LOOPCONT CSECT
USING LOOPCONT,R12
LR R12,R15
BEGIN LA R8,0
SR R5,R5
LA R6,1
LA R7,10
LOOPI BXH R5,R6,ELOOPI for i=1 to 10
LA R3,MVC(R8)
XDECO R5,XDEC
MVC 0(4,R3),XDEC+8
LA R8,4(R8)
LR R10,R5
LA R1,5
SRDA R10,32
DR R10,R1
LTR R10,R10
BNZ COMMA
XPRNT MVC,80
LA R8,0
B NEXTI
COMMA LA R3,MVC(R8)
MVC 0(2,R3),=C', '
LA R8,2(R8)
NEXTI B LOOPI next i
ELOOPI XR R15,R15
BR R14
MVC DC CL80' '
XDEC DS CL16
YREGS
END LOOPCONT

View file

@ -0,0 +1,9 @@
FOR i FROM 1 TO 10 DO
print ((i,
IF i MOD 5 = 0 THEN
new line
ELSE
","
FI
))
OD

View file

@ -0,0 +1,9 @@
begin
i_w := 1; s_w := 0; % set output format %
for i := 1 until 10 do begin
writeon( i );
if i rem 5 = 0
then write()
else writeon( ", " )
end for_i
end.

View file

@ -0,0 +1,10 @@
BEGIN {
for(i=1; i <= 10; i++) {
printf("%d", i)
if ( i % 5 == 0 ) {
print
continue
}
printf(", ")
}
}

View file

@ -0,0 +1,15 @@
with Ada.Text_IO;
use Ada.Text_IO;
procedure Loop_Continue is
begin
for I in 1..10 loop
Put (Integer'Image(I));
if I = 5 or I = 10 then
New_Line;
goto Continue;
end if;
Put (",");
<<Continue>> --Ada 2012 no longer requires a statement after the label
end loop;
end Loop_Continue;

View file

@ -0,0 +1,18 @@
with Ada.Text_IO;
use Ada.Text_IO;
procedure Loop_Continue is
begin
Print_All:
for I in 1 .. 10 loop
Print_Element: loop
Put (Integer'Image(I));
if I = 5 or I = 10 then
New_Line;
exit Print_Element;
end if;
Put (",");
exit Print_Element;
end loop Print_Element;
end loop Print_All;
end Loop_Continue;

View file

@ -0,0 +1,7 @@
for i to 10 do
write( i );
if i % 5 = 0
then write( "\n" )
else write( ", " )
fi
od

View file

@ -0,0 +1,8 @@
foreach i 1..10 {
print (i)
if ((i % 5) == 0) {
println()
continue
}
print (", ")
}

View file

@ -0,0 +1,9 @@
set table to {return}
repeat with i from 1 to 10
if i < 5 or (i 6 and i < 10) then
set end of table to i & ", "
else if i = 5 or i = 10 then
set end of table to i & return
end if
end repeat
return table as string

View file

@ -0,0 +1,5 @@
10 FOR I = 1 TO 10
20 PRINT I;
30 IF I - INT (I / 5) * 5 = 0 THEN PRINT : GOTO 50"CONTINUE
40 PRINT ", ";
50 NEXT

View file

@ -0,0 +1,8 @@
loop 1..10 'i [
prints i
if 0 = i%5 [
print ""
continue
]
prints ", "
]

View file

@ -0,0 +1,9 @@
for(int i = 1; i <= 10; ++i) {
write(i, suffix=none);
if(i % 5 == 0) {
write("");
continue;
} else {
write(", ", suffix=none);
}
}

View file

@ -0,0 +1,5 @@
Loop, 10 {
Delimiter := (A_Index = 5) || (A_Index = 10) ? "`n":", "
Index .= A_Index . Delimiter
}
MsgBox %Index%

View file

@ -0,0 +1,10 @@
for i = 1 to 10
print string(i);
if i mod 5 = 0 then
print
continue for
end if
print ", ";
next
print
end

View file

@ -0,0 +1,4 @@
FOR i% = 1 TO 10
PRINT ; i% ;
IF i% MOD 5 = 0 PRINT ELSE PRINT ", ";
NEXT

View file

@ -0,0 +1,11 @@
get "libhdr"
let start() be
for i = 1 to 10
$( writen(i)
if i rem 5 = 0
$( wrch('*N')
loop
$)
writes(", ")
$)

View file

@ -0,0 +1,9 @@
for (i = 1; i <= 10; i++) {
print i
if (i % 5) {
print ", "
continue
}
print "\n"
}
quit

View file

@ -0,0 +1,6 @@
1>:56+\`#v_@
+v %5:.:<
1>#v_55+,v
^ <
>" ,",,v
^ <

View file

@ -0,0 +1,6 @@
1>:56+\`#v_@
+v5:,8.:<
1>%#v_55+,v
^ <
>" ,",v
^ ,<

View file

@ -0,0 +1,11 @@
( 0:?i
& whl
' ( 1+!i:~>10:?i
& put
$ ( str
$ ( !i
(mod$(!i.5):0&\n|", ")
)
)
)
);

View file

@ -0,0 +1,8 @@
for(int i = 1;i <= 10; i++){
cout << i;
if(i % 5 == 0){
cout << endl;
continue;
}
cout << ", ";
}

View file

@ -0,0 +1,16 @@
using System;
class Program {
static void Main(string[] args) {
for (int i = 1; i <= 10; i++) {
Console.Write(i);
if (i % 5 == 0) {
Console.WriteLine();
continue;
}
Console.Write(", ");
}
}
}

View file

@ -0,0 +1,8 @@
for(int i = 1;i <= 10; i++){
printf("%d", i);
if(i % 5 == 0){
printf("\n");
continue;
}
printf(", ");
}

View file

@ -0,0 +1,21 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. loop-continue.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 i PIC 99.
PROCEDURE DIVISION.
PERFORM VARYING i FROM 1 BY 1 UNTIL 10 < i
DISPLAY i WITH NO ADVANCING
IF FUNCTION MOD(i, 5) = 0
DISPLAY SPACE
EXIT PERFORM CYCLE
END-IF
DISPLAY ", " WITH NO ADVANCING
END-PERFORM
GOBACK
.

View file

@ -0,0 +1,8 @@
for i in 1..10 {
write(i);
if i % 5 == 0 then {
writeln();
continue;
}
write(", ");
}

View file

@ -0,0 +1,8 @@
FOR i := 1 TO 10
?? i
IF i % 5 == 0
?
LOOP
ENDIF
?? ", "
NEXT

View file

@ -0,0 +1,5 @@
(doseq [n (range 1 11)]
(print n)
(if (zero? (rem n 5))
(println)
(print ", ")))

View file

@ -0,0 +1,7 @@
(loop [xs (range 1 11)]
(when-let [x (first xs)]
(print x)
(if (zero? (rem x 5))
(println)
(print ", "))
(recur (rest xs))))

View file

@ -0,0 +1,12 @@
<cfscript>
for( i = 1; i <= 10; i++ )
{
writeOutput( i );
if( 0 == i % 5 )
{
writeOutput( "< br />" );
continue;
}
writeOutput( "," );
}
</cfscript>

View file

@ -0,0 +1,5 @@
10 FOR I = 1 to 10
20 PRINT I;
30 IF INT(I/5) = I/5 THEN PRINT : GOTO 50
40 PRINT ", ";
50 NEXT

View file

@ -0,0 +1,19 @@
(do ((i 1 (1+ i)))
((> i 10))
(format t "~a~:[, ~;~%~]" i (zerop (mod i 5))))
(do ((i 1 (1+ i)))
((> i 10))
(write i)
(when (zerop (mod i 5))
(terpri)
(go end))
(write-string ", ")
end)
(do ((i 1 (1+ i)))
((> i 10))
(write i)
(if (zerop (mod i 5))
(terpri)
(write-string ", ")))

View file

@ -0,0 +1,14 @@
(loop for i from 1 to 10
do (write i)
if (zerop (mod i 5))
do (terpri)
else
do (write-string ", "))
(loop for i from 1 to 10 do
(block continue
(write i)
(when (zerop (mod i 5))
(terpri)
(return-from continue))
(write-string ", ")))

View file

@ -0,0 +1,12 @@
include "cowgol.coh";
var n: uint8 := 0;
while n < 10 loop
n := n + 1;
print_i8(n);
if n % 5 == 0 then
print_nl();
continue;
end if;
print(", ");
end loop;

View file

@ -0,0 +1,12 @@
import std.stdio;
void main() {
foreach (i; 1 .. 11) {
write(i);
if (i % 5 == 0) {
writeln();
continue;
}
write(", ");
}
}

View file

@ -0,0 +1,6 @@
import std.stdio;
void main()
{
foreach(i; 1..11) i % 5 ? writef("%s, ", i) : writeln(i);
}

View file

@ -0,0 +1,10 @@
var i : Integer;
for i := 1 to 10 do begin
Print(i);
if i mod 5 = 0 then begin
PrintLn('');
continue;
end;
Print(', ');
end;

View file

@ -0,0 +1,12 @@
1 si # i = 1
[2Q]sA # A = code to break loop
[[, ]P 1J]sB # B = code to print comma, continue loop
[
li n # print i
li 5 % 0 !=B # call B if i % 5
[
]P # print newline
M # mark from calling B
li 1 + si # i += 1
li 10!<C # continue loop if 10 >= i
]sC li 10!<C # enter loop if 10 >= i

View file

@ -0,0 +1,15 @@
program DoLoop(output);
var
i: integer;
begin
for i := 1 to 10 do
begin
write(i);
if i mod 5 = 0 then
begin
writeln;
continue;
end;
write(', ');
end;
end.

View file

@ -0,0 +1,8 @@
for i in 1..10 {
print(i, terminator: "")
if i % 5 == 0 {
print()
continue
}
print(", ", terminator: "")
}

View file

@ -0,0 +1,8 @@
for int i = 1; i <= 10; ++i
write(i)
if i % 5 == 0
writeLine()
continue
end
write(", ")
end

View file

@ -0,0 +1,10 @@
FOR I=1 TO 10 DO
PRINT(I;CHR$(29);) ! printing a numeric value leaves a blank after it
! chr$(29) delete it.....
IF I MOD 5=0 THEN
PRINT
CONTINUE FOR
END IF
PRINT(",";)
END FOR
PRINT

View file

@ -0,0 +1,13 @@
open monad io
loop n =
if n > 10 then do
return ()
else do
putStr (show n)
putStr f
loop (n + 1)
where f | n % 5 == 0 = "\r\n"
| else = ", "
_ = loop 1 ::: IO

View file

@ -0,0 +1,11 @@
open monad io
loop [] = return ()
loop (x::xs) = do
putStr (show x)
putStr f
loop xs
where f | x % 5 == 0 = "\r\n"
| else = ", "
_ = loop [1..10] ::: IO

View file

@ -0,0 +1,10 @@
defmodule Loops do
def continue do
Enum.each(1..10, fn i ->
IO.write i
IO.write if rem(i,5)==0, do: "\n", else: ", "
end)
end
end
Loops.continue

View file

@ -0,0 +1,21 @@
%% Implemented by Arjun Sunel
-module(continue).
-export([main/0, for_loop/1]).
main() ->
for_loop(1).
for_loop(N) when N /= 5 , N <10 ->
io:format("~p, ",[N] ),
for_loop(N+1);
for_loop(N) when N >=10->
if N=:=10 ->
io:format("~p\n",[N] )
end;
for_loop(N) ->
if N=:=5 ->
io:format("~p\n",[N] ),
for_loop(N+1)
end.

View file

@ -0,0 +1,11 @@
include std\console.e --only for any_key to make running command window easier on windows
for i = 1 to 10 do
if remainder(i,5) = 0 then
printf(1, "%d\n", i)
else
printf(1,"%d, ", i)
continue
end if
end for
any_key()

View file

@ -0,0 +1,18 @@
include std\console.e --only for any_key to make running command window easier on windows
for i = 1 to 10 do
if remainder(i,5) = 0 then
switch i do
case 10 then
printf(1,"%d ",i)
break --new to euphoria 4.0.0+
case else
printf(1,"%d\n", i)
end switch
else
printf(1,"%d, ", i)
continue --new to euphoria 4.0.0+
end if
end for
any_key()

View file

@ -0,0 +1,6 @@
for i in 1 .. 10 do
printf "%d" i
if i % 5 = 0 then
printf "\n"
else
printf ", "

View file

@ -0,0 +1,5 @@
let fN g=quibble (Seq.initInfinite(fun n ->if (n+1)%5=0 || (n+1)=List.length g then "\n" else ", ")) g
fN [1] |> Seq.iter(fun(n,g)->printf "%d%s" n g)
fN [1..9] |> Seq.iter(fun(n,g)->printf "%d%s" n g)
fN [1..10] |> Seq.iter(fun(n,g)->printf "%d%s" n g)
fN [1..11] |> Seq.iter(fun(n,g)->printf "%d%s" n g)

View file

@ -0,0 +1,4 @@
1 10 [a,b] [
[ number>string write ]
[ 5 mod 0 = "\n" ", " ? write ] bi
] each

View file

@ -0,0 +1,17 @@
class LoopsContinue
{
public static Void main ()
{
for (Int i := 1; i <= 10; ++i)
{
Env.cur.out.print (i)
if (i % 5 == 0)
{
Env.cur.out.printLine ("")
continue
}
Env.cur.out.print (", ")
}
Env.cur.out.printLine ("")
}
}

View file

@ -0,0 +1,5 @@
: main
11 1 do
i dup 1 r.
5 mod 0= if cr else [char] , emit space then
loop ;

View file

@ -0,0 +1,8 @@
do i = 1, 10
write(*, '(I0)', advance='no') i
if ( mod(i, 5) == 0 ) then
write(*,*)
cycle
end if
write(*, '(A)', advance='no') ', '
end do

View file

@ -0,0 +1,67 @@
C WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C one nonstandard character on the line labelled 5001. Many F77
C compilers should be okay with it, but it is *not* standard.
C
C It is also worth noting that FORTRAN 77 uses the command CONTINUE,
C but not in the semantic, looping sense of the word. In FORTRAN,
C CONTINUE means "do absolutely nothing." It is a placeholder. If
C anything, it means "continue to the next line."
C
C Python does the same thing with `pass`; C and its family of
C languages, with `{/* do nothing */}`. Write CONTINUE when you need
C to write something but have nothing to write.
C
C This page on Rosetta Code is about a very different "continue"
C statement that tells a loop to go back to the beginning. In
C FORTRAN, we use (you guessed it!) a GOTO to accomplish this.
PROGRAM CONTINUELOOP
INTEGER I
DO 10 I = 1, 10
C Is it five or ten?
IF (MOD(I, 5) .EQ. 0) THEN
C If it is, write a newline and no comma.
WRITE (*,5000) I
C Continue the loop; that is, skip to the end of the loop.
GOTO 10
ENDIF
C Write I with a comma and no newline.
WRITE (*,5001) I
C Again, in this case, CONTINUE is completely unrelated to the
C semantic, looping sense of the word.
10 CONTINUE
STOP
C This will print an integer and a newline (no comma).
5000 FORMAT (I3)
C Standard FORTRAN 77 is completely incapable of completing a
C WRITE statement without printing a newline. If you want to print
C five integers in standard code, you have to do something like
C this:
C
C FORMAT (I3, ',', I3, ',', I3, ',', I3, ',', I3)
C
C Writing `1, 2, 3, 4, 5` and then `6, 7, 8, 9, 10` to that format
C would produce the following two lines:
C
C 1, 2, 3, 4, 5
C 6, 7, 8, 9, 10
C
C However, this code exists to demonstrate continuing a FORTRAN 77
C loop and not to demonstrate how to get around its rigidity about
C newlines.
C
C The dollar sign at the end of the format is a nonstandard
C character. It tells the compiler not to print a newline. If you
C are actually using FORTRAN 77, you should figure out what your
C particular compiler accepts. If you are actually using Fortran
C 90 or later, you should replace this line with the commented
C line that follows it.
5001 FORMAT (I3, ',', $)
C5001 FORMAT (I3, ',', ADVANCE='NO')
END

View file

@ -0,0 +1,3 @@
WRITE (6,1) (I,I = 1,10)
1 FORMAT (4(1X,I0,","),1X,I0)
END

View file

@ -0,0 +1,12 @@
' FB 1.05.0 Win64
For i As Integer = 1 To 10
Print Str(i);
If i Mod 5 = 0 Then
Print
Continue For
End If
Print ", ";
Next
Print
Sleep

View file

@ -0,0 +1,13 @@
include "NSLog.incl"
long num
for num = 1 to 10
if ( num mod 5 )
NSLog(@"%ld, \b",num)
else
NSLog(@"%ld",num)
end if
next
HandleEvents

View file

@ -0,0 +1,10 @@
for i in [1 .. 11] do
if RemInt(i, 5) = 0 then
Print(i, "\n");
continue;
fi;
Print(i, ", ");
od;
# 1, 2, 3, 4, 5
# 6, 7, 8, 9, 10

View file

@ -0,0 +1,11 @@
extends MainLoop
func _process(_delta: float) -> bool:
for i in range(1,11):
if i % 5 == 0:
print(i)
continue
printraw(i, ", ")
return true # Exit

View file

@ -0,0 +1,7 @@
for(i = 1; i <= 10; i += 1)
{
show_message(string(i))
i += 1
if(i <= 10)
continue
}

View file

@ -0,0 +1,10 @@
Public Sub Main()
Dim siCount As Short
For siCount = 1 To 10
Print siCount;
If siCount <> 5 And siCount <> 10 Then Print ",";
If siCount = 5 Then Print gb.NewLine;
Next
End

View file

@ -0,0 +1,14 @@
package main
import "fmt"
func main() {
for i := 1; i <= 10; i++ {
fmt.Printf("%d", i)
if i%5 == 0 {
fmt.Printf("\n")
continue
}
fmt.Printf(", ")
}
}

View file

@ -0,0 +1,8 @@
for (i in 1..10) {
print i
if (i % 5 == 0) {
println ()
continue
}
print ', '
}

View file

@ -0,0 +1,5 @@
import Control.Monad (forM)
main = forM [1..10] out
where
out x | x `mod` 5 == 0 = print x
| otherwise = (putStr . (++", ") . show) x

View file

@ -0,0 +1,8 @@
for (i in 1...11) {
Sys.print(i);
if (i % 5 == 0) {
Sys.print('\n');
continue;
}
Sys.print(', ');
}

View file

@ -0,0 +1,7 @@
DO i = 1, 10
IF( MOD(i, 5) == 1 ) THEN
WRITE(Format="i3") i
ELSE
WRITE(APPend, Format=" ',', i3 ") i
ENDIF
ENDDO

View file

@ -0,0 +1,8 @@
100 FOR I=1 TO 10
110 PRINT STR$(I);
120 IF MOD(I,5)=0 THEN
130 PRINT
140 ELSE
150 PRINT ", ";
160 END IF
170 NEXT

View file

@ -0,0 +1,9 @@
procedure main()
every writes(x := 1 to 10) do {
if x % 5 = 0 then {
write()
next
}
writes(", ")
}
end

View file

@ -0,0 +1 @@
every writes(x := 1 to 10, if x % 5 = 0 then "\n" else ", ")

View file

@ -0,0 +1,5 @@
for(i,1,10,
write(i)
if(i%5 == 0, writeln() ; continue)
write(" ,")
)

View file

@ -0,0 +1 @@
_2}."1'lq<, >'8!:2>:i.2 5

View file

@ -0,0 +1,15 @@
3 : 0 ] 10
z=.''
for_i. 1 + i.y do.
z =. z , ": i
if. 0 = 5 | i do.
z 1!:2 ]2
z =. ''
continue.
end.
z =. z , ', '
end.
i.0 0
)

View file

@ -0,0 +1,9 @@
fn main() {
for i in 1..11 {
if i % 5 == 0 {
println("{}", i)
continue
}
print("{}, ", i)
}
}

View file

@ -0,0 +1,8 @@
for(int i = 1;i <= 10; i++){
System.out.print(i);
if(i % 5 == 0){
System.out.println();
continue;
}
System.out.print(", ");
}

View file

@ -0,0 +1,10 @@
var output = "";
for (var i = 1; i <= 10; i++) {
output += i;
if (i % 5 == 0) {
print(output);
output = "";
continue;
}
output += ", ";
}

View file

@ -0,0 +1,11 @@
function rng(n) {
return n ? rng(n - 1).concat(n) : [];
}
console.log(
rng(10).reduce(
function (a, x) {
return a + x.toString() + (x % 5 ? ', ' : '\n');
}, ''
)
);

View file

@ -0,0 +1,2 @@
1, 2, 3, 4, 5
6, 7, 8, 9, 10

View file

@ -0,0 +1,2 @@
reduce range(1;11) as $i
(""; . + "\($i)" + (if $i % 5 == 0 then "\n" else ", " end))

View file

@ -0,0 +1,9 @@
/* Loop/continue in jsish */
for (var i = 1; i <= 10; i++) {
printf("%d", i);
if (i % 5 == 0) {
printf("\n");
continue;
}
printf(", ");
}

View file

@ -0,0 +1,8 @@
for i in 1:10
print(i)
if i%5 == 0
println()
continue
end
print(", ")
end

View file

@ -0,0 +1,11 @@
// version 1.1.2
fun main(args: Array<String>) {
for(i in 1 .. 10) {
if (i % 5 == 0) {
println(i)
continue
}
print("$i, ")
}
}

View file

@ -0,0 +1,12 @@
{def loops_continue
{lambda {:i}
{if {> :i 10}
then (end of loop)
else {if {= :i 6} then {br}:i else :i}
{if {= :i 10} then . else ,}
{loops_continue {+ :i 1}}}}}
-> loops_continue
{loops_continue 0}
-> 0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10. (end of loop)

View file

@ -0,0 +1,12 @@
$i = 0
while($i < 10) {
$i += 1
if($i % 5 === 0) {
fn.println($i)
con.continue
}
fn.print($i\,\s)
}

View file

@ -0,0 +1,5 @@
for .i of 10 {
write .i
if .i div 5 { writeln(); next }
write ", "
}

View file

@ -0,0 +1,6 @@
loop(10) => {^
loop_count
loop_count % 5 ? ', ' | '\r'
loop_count < 100 ? loop_continue
'Hello, World!' // never gets executed
^}

View file

@ -0,0 +1,4 @@
for i =1 to 10
if i mod 5 <>0 then print i; ", "; else print i
next i
end

View file

@ -0,0 +1,10 @@
str = ""
repeat with i = 1 to 10
put i after str
if i mod 5 = 0 then
put RETURN after str
next repeat
end if
put ", " after str
end repeat
put str

View file

@ -0,0 +1,4 @@
1.to 10 do { i : INTEGER;
i.print;
(i % 5 = 0).if { '\n'.print; } else { ','.print; };
};

View file

@ -0,0 +1,5 @@
repeat with n = 1 to 10
put n
if n is 5 then put return
if n < 10 and n is not 5 then put ","
end repeat

View file

@ -0,0 +1,8 @@
for i = 1, 10 do
io.write( i )
if i % 5 == 0 then
io.write( "\n" )
else
io.write( ", " )
end
end

View file

@ -0,0 +1,9 @@
for i = 1, 10 do
io.write( i )
if i % 5 == 0 then
io.write( "\n" )
goto continue
end
io.write( ", " )
::continue::
end

View file

@ -0,0 +1,36 @@
Module Checkit {
\\ A For {} loop
For i=1 to 10 {
Print i;
if i mod 5 Else Print : continue
Print ",";
}
Print i=11
\\ A For Next loop
For i=1 to 10
Print i;
if i mod 5 Else Print : continue
Print ",";
Next i
Print i=11
\\ A for loop using a block and a Loop statement
i=0
{ i++
if i>10 then Exit
loop
Print i;
if i mod 5 Else Print : continue
Print ",";
}
Print i=11
\\ as above but end value for i=10 not 11
i=0
{ i++
if i<10 then loop
Print i;
if i mod 5 Else Print : continue
Print ",";
}
Print i=10 ' not 11 but 10
}
Checkit

View file

@ -0,0 +1 @@
disp([1:5; 6:10])

View file

@ -0,0 +1 @@
disp(reshape([1:10],5,2)')

View file

@ -0,0 +1,7 @@
for i = 1:10
printf(' %2d', i);
if ( mod(i, 5) == 0 )
printf('\n');
continue
end
end

View file

@ -0,0 +1,10 @@
for i in 1 to 10 do
(
format "%" i
if mod i 5 == 0 then
(
format "\n"
continue
) continue
format ", "
)

View file

@ -0,0 +1,10 @@
s = "";
for i in [1..10]
s += tostr(i);
if (i % 5 == 0)
player:tell(s);
s = "";
continue;
endif
s += ", ";
endfor

Some files were not shown because too many files have changed in this diff Show more