Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,6 @@
---
category:
- Conditional loops
- Simple
from: http://rosettacode.org/wiki/Loops/Do-while
note: Iteration

View file

@ -0,0 +1,27 @@
Start with a value at 0. Loop while value mod 6 is not equal to 0.
Each time through the loop, add 1 to the value then print it.
The loop must execute at least once.
;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]]
;Reference:
* [[wp:Do while loop|Do while loop]] Wikipedia.
<br><br>

View file

@ -0,0 +1,6 @@
V val = 0
L
val++
print(val)
I val % 6 == 0
L.break

View file

@ -0,0 +1,27 @@
* Do-While
DOWHILE CSECT , This program's control section
BAKR 14,0 Caller's registers to linkage stack
LR 12,15 load entry point address into Reg 12
USING DOWHILE,12 tell assembler we use Reg 12 as base
XR 9,9 clear Reg 9 - divident value
LA 6,6 load divisor value 6 in Reg 6
LA 8,WTOLEN address of WTO area in Reg 8
LOOP DS 0H
LA 9,1(,9) add 1 to divident Reg 9
ST 9,FW2 store it
LM 4,5,FDOUBLE load into even/odd register pair
STH 9,WTOTXT store divident in text area
MVI WTOTXT,X'F0' first of two bytes zero
OI WTOTXT+1,X'F0' make second byte printable
WTO TEXT=(8) print it (Write To Operator macro)
DR 4,6 divide Reg pair 4,5 by Reg 6
LTR 5,5 test quotient (remainder in Reg 4)
BNZ RETURN if one: 6 iterations, exit loop.
B LOOP if zero: loop again.
RETURN PR , return to caller.
FDOUBLE DC 0FD
DC F'0'
FW2 DC F'0'
WTOLEN DC H'2' fixed WTO length of two
WTOTXT DC CL2' '
END DOWHILE

View file

@ -0,0 +1,21 @@
* Do-While 27/06/2016
DOWHILE CSECT
USING DOWHILE,12 set base register
LR 12,15 init base register
SR 6,6 v=0
LA 4,1 init reg 4
DO UNTIL=(LTR,4,Z,4) do until v mod 6=0
LA 6,1(6) v=v+1
STC 6,WTOTXT v
OI WTOTXT,X'F0' make editable
WTO MF=(E,WTOMSG) display v
LR 4,6 v
SRDA 4,32 shift dividend to reg 5
D 4,=F'6' v/6 so r4=remain & r5=quotient
ENDDO , end do
BR 14 return to caller
WTOMSG DS 0F full word alignment for wto
WTOLEN DC AL2(L'WTOTXT+4) length of WTO buffer
DC H'0' must be zero
WTOTXT DS C one char
END DOWHILE

View file

@ -0,0 +1,18 @@
DoWhileSub: PHA
TYA
PHA ;push accumulator and Y register onto stack
LDY #0
DoWhileLoop: INY
JSR DisplayValue ;routine not implemented
TYA
SEC
Modulus: SBC #6
BCS Modulus
ADC #6
BNE DoWhileLoop
PLA
TAY
PLA ;restore Y register and accumulator from stack
RTS ;return from subroutine

View file

@ -0,0 +1,53 @@
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program loopdowhile64.s */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*********************************/
/* Initialized data */
/*********************************/
.data
szMessResult: .asciz "Counter = @ \n" // message result
/*********************************/
/* UnInitialized data */
/*********************************/
.bss
sZoneConv: .skip 24
/*********************************/
/* code section */
/*********************************/
.text
.global main
main: // entry of program
mov x20,0 // indice
mov x21,6
1: // begin loop
mov x0,x20
ldr x1,qAdrsZoneConv // conversion value value
bl conversion10 // decimal
ldr x0,qAdrszMessResult
ldr x1,qAdrsZoneConv // display conversion
bl strInsertAtCharInc // insert result at @ character
bl affichageMess // display message
add x20,x20,1 // increment counter
udiv x0,x20,x21 // divide by 6
msub x1,x0,x21,x20 // compute remainder
cbnz x1,1b // loop if remainder <> zéro
100: // standard end of the program
mov x0,0 // return code
mov x8,EXIT // request to exit program
svc 0 // perform the system call
qAdrsZoneConv: .quad sZoneConv
qAdrszMessResult: .quad szMessResult
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"

View file

@ -0,0 +1,10 @@
'BEGIN' 'COMMENT' Loops DoWhile - Algol60 - 22/06/2018;
'INTEGER' I;
I:=0;
LOOP:
I:=I+1;
OUTINTEGER(1,I);
'IF' I=I'/'6*6 'THEN' 'GOTO' ENDLOOP;
'GOTO' LOOP;
ENDLOOP:
'END'

View file

@ -0,0 +1,14 @@
begin
integer i;
boolean another;
i := 0;
another := true;
for i := i + 1 while another do
begin
outinteger(1,i);
comment - repeat until i mod 6 = 0;
if i = (i div 6) * 6 then another := false;
end;
end

View file

@ -0,0 +1,5 @@
FOR value WHILE
print(value);
# WHILE # value MOD 6 /= 0 DO
SKIP
OD

View file

@ -0,0 +1,11 @@
begin
integer i;
i := 0;
while
begin
i := i + 1;
write( i );
( i rem 6 ) not = 0
end
do begin end
end.

View file

@ -0,0 +1,140 @@
/* ARM assembly Raspberry PI */
/* program loopdowhile.s */
/* Constantes */
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall
.equ WRITE, 4 @ Linux syscall
/*********************************/
/* Initialized data */
/*********************************/
.data
szMessResult: .ascii "Counter = " @ message result
sMessValeur: .fill 12, 1, ' '
.asciz "\n"
/*********************************/
/* UnInitialized data */
/*********************************/
.bss
/*********************************/
/* code section */
/*********************************/
.text
.global main
main: @ entry of program
push {fp,lr} @ saves 2 registers
mov r4,#0
1: @ begin loop
mov r0,r4
ldr r1,iAdrsMessValeur @ display value
bl conversion10 @ call function with 2 parameter (r0,r1)
ldr r0,iAdrszMessResult
bl affichageMess @ display message
add r4,#1 @ increment counter
mov r0,r4
mov r1,#6 @ division conuter by 6
bl division
cmp r3,#0 @ remainder = zéro ?
bne 1b @ no ->begin loop one
100: @ standard end of the program
mov r0, #0 @ return code
pop {fp,lr} @restaur 2 registers
mov r7, #EXIT @ request to exit program
svc #0 @ perform the system call
iAdrsMessValeur: .int sMessValeur
iAdrszMessResult: .int szMessResult
/******************************************************************/
/* display text with size calculation */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
push {r0,r1,r2,r7,lr} @ save registres
mov r2,#0 @ counter length
1: @ loop length calculation
ldrb r1,[r0,r2] @ read octet start position + index
cmp r1,#0 @ if 0 its over
addne r2,r2,#1 @ else add 1 in the length
bne 1b @ and loop
@ so here r2 contains the length of the message
mov r1,r0 @ address message in r1
mov r0,#STDOUT @ code to write to the standard output Linux
mov r7, #WRITE @ code call system "write"
svc #0 @ call systeme
pop {r0,r1,r2,r7,lr} @ restaur des 2 registres */
bx lr @ return
/******************************************************************/
/* Converting a register to a decimal */
/******************************************************************/
/* r0 contains value and r1 address area */
conversion10:
push {r1-r4,lr} @ save registers
mov r3,r1
mov r2,#10
1: @ start loop
bl divisionpar10 @ r0 <- dividende. quotient ->r0 reste -> r1
add r1,#48 @ digit
strb r1,[r3,r2] @ store digit on area
sub r2,#1 @ previous position
cmp r0,#0 @ stop if quotient = 0 */
bne 1b @ else loop
@ and move spaces in first on area
mov r1,#' ' @ space
2:
strb r1,[r3,r2] @ store space in area
subs r2,#1 @ @ previous position
bge 2b @ loop if r2 >= zéro
100:
pop {r1-r4,lr} @ restaur registres
bx lr @return
/***************************************************/
/* division par 10 signé */
/* Thanks to http://thinkingeek.com/arm-assembler-raspberry-pi/*
/* and http://www.hackersdelight.org/ */
/***************************************************/
/* r0 dividende */
/* r0 quotient */
/* r1 remainder */
divisionpar10:
/* r0 contains the argument to be divided by 10 */
push {r2-r4} /* save registers */
mov r4,r0
mov r3,#0x6667 @ r3 <- magic_number lower
movt r3,#0x6666 @ r3 <- magic_number upper
smull r1, r2, r3, r0 @ r1 <- Lower32Bits(r1*r0). r2 <- Upper32Bits(r1*r0)
mov r2, r2, ASR #2 /* r2 <- r2 >> 2 */
mov r1, r0, LSR #31 /* r1 <- r0 >> 31 */
add r0, r2, r1 /* r0 <- r2 + r1 */
add r2,r0,r0, lsl #2 /* r2 <- r0 * 5 */
sub r1,r4,r2, lsl #1 /* r1 <- r4 - (r2 * 2) = r4 - (r0 * 10) */
pop {r2-r4}
bx lr /* leave function */
/***************************************************/
/* integer division unsigned */
/***************************************************/
division:
/* r0 contains dividend */
/* r1 contains divisor */
/* r2 returns quotient */
/* r3 returns remainder */
push {r4, lr}
mov r2, #0 @ init quotient
mov r3, #0 @ init remainder
mov r4, #32 @ init counter bits
b 2f
1: @ loop
movs r0, r0, LSL #1 @ r0 <- r0 << 1 updating cpsr (sets C if 31st bit of r0 was 1)
adc r3, r3, r3 @ r3 <- r3 + r3 + C. This is equivalent to r3 ? (r3 << 1) + C
cmp r3, r1 @ compute r3 - r1 and update cpsr
subhs r3, r3, r1 @ if r3 >= r1 (C=1) then r3 ? r3 - r1
adc r2, r2, r2 @ r2 <- r2 + r2 + C. This is equivalent to r2 <- (r2 << 1) + C
2:
subs r4, r4, #1 @ r4 <- r4 - 1
bpl 1b @ if r4 >= 0 (N=0) then loop
pop {r4, lr}
bx lr

View file

@ -0,0 +1,14 @@
REM Loops/Do-while
I = 0
REM first iteration - before the While
I = I + 1
PRINT I
IMod6 = I MOD 6
WHILE IMod6 <> 0
I = I + 1
PRINT I
IMod6 = I MOD 6
WEND
END

View file

@ -0,0 +1,10 @@
REM Loops/Do-while
I = 0
LoopStart:
I = I + 1
PRINT I
IMod6 = I MOD 6
IF IMod6 <> 0 THEN LoopStart:
END

View file

@ -0,0 +1,7 @@
BEGIN {
val = 0
do {
val++
print val
} while( val % 6 != 0)
}

View file

@ -0,0 +1,10 @@
Proc Main()
byte A
A=0
Do
A==+1
PrintBE(A)
Until A Mod 6=0
Od
Return

View file

@ -0,0 +1,5 @@
var val:int = 0;
do
{
trace(++val);
} while (val % 6);

View file

@ -0,0 +1,5 @@
loop
Value := Value + 1;
Put (Value);
exit when Value mod 6 = 0;
end loop;

View file

@ -0,0 +1,4 @@
for Value in 0..Integer'Last loop
Put (Value);
exit when Value mod 6 = 0;
end loop;

View file

@ -0,0 +1,7 @@
scope
local i := 0;
do
inc i, 1;
print( i )
as ( i % 6 ) <> 0
epocs

View file

@ -0,0 +1,8 @@
integer a;
a = 0;
do {
a += 1;
o_integer(a);
o_byte('\n');
} while (a % 6 != 0);

View file

@ -0,0 +1,7 @@
PROC main()
DEF i = 0
REPEAT
i := i + 1
WriteF('\d\n', i)
UNTIL Mod(i, 6) = 0
ENDPROC

View file

@ -0,0 +1,10 @@
on printConsole(x)
return x as string
end printConsole
set {i, table} to {0, {return}}
repeat while (i mod 6 is not 0 or i is not 6)
set i to i + 1
set end of table to i & return
printConsole(table)
end repeat

View file

@ -0,0 +1,7 @@
0 REMADE FOR DO WHILE
1 DEF FN MOD6(N) = N - INT (N / 6) * 6
2 LET V4LUE = 0
3 FOR DO = 0 TO 1
10 LET V4LUE = V4LUE + 1
20 PRINT V4LUE" ";
30 WHILE = FN MOD6(V4LUE) < > 0:DO = NOT WHILE: NEXT

View file

@ -0,0 +1,5 @@
value: 0
until [
value: value + 1
print value
] [ 0 = value%6 ]

View file

@ -0,0 +1,5 @@
int i = 0;
do {
++i;
write(" ", i, suffix=none);
} while (i % 6 != 0);

View file

@ -0,0 +1,3 @@
While mod(A_Index, 6) ;comment:everything but 0 is considered true
output = %output%`n%A_Index%
MsgBox % output

View file

@ -0,0 +1,5 @@
0→A
While 1
A++
Disp A▶Dec,i
End!If A^6

View file

@ -0,0 +1,8 @@
i = 0
do
i += 1
print i; " ";
until i mod 6 = 0
print
end

View file

@ -0,0 +1,5 @@
a = 0
REPEAT
a = a + 1
PRINT a
UNTIL a MOD 6 = 0

View file

@ -0,0 +1,5 @@
a=0
REPEAT
INCR a
PRINT a
UNTIL MOD(a,6) == 0

View file

@ -0,0 +1,6 @@
i = 0
for (;;) {
++i /* increments then prints i */
if (i % 6 == 0) break
}
quit

View file

@ -0,0 +1,3 @@
0>1+:.v
|%6: <
@

View file

@ -0,0 +1,5 @@
int val = 0;
do{
val++;
std::cout << val << std::endl;
}while(val % 6 != 0);

View file

@ -0,0 +1,7 @@
int a = 0;
do
{
a += 1;
Console.WriteLine(a);
} while (a % 6 != 0);

View file

@ -0,0 +1,5 @@
int val = 0;
do{
val++;
printf("%d\n",val);
}while(val % 6 != 0);

View file

@ -0,0 +1,15 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. loop-do-while.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 i PIC 99 VALUE 0.
PROCEDURE DIVISION.
PERFORM WITH TEST AFTER UNTIL FUNCTION MOD(i, 6) = 0
ADD 1 TO i
DISPLAY i
END-PERFORM
GOBACK
.

View file

@ -0,0 +1,5 @@
var val = 0;
do {
val += 1;
writeln(val);
} while val % 6 > 0;

View file

@ -0,0 +1,7 @@
100 rem Loops/Do-while
110 i = 0
120 do
130 i = i+1
140 print i
150 loop until i mod 6 = 0
160 end

View file

@ -0,0 +1,7 @@
0 => int value;
do
{
value++;
<<<value>>>;
}
while(value % 6 != 0);

View file

@ -0,0 +1,7 @@
Local n := 0
DO WHILE .T.
? ++n
IF n % 6 == 0
EXIT
ENDIF
ENDDO

View file

@ -0,0 +1,5 @@
(loop [i 0]
(let [i* (inc i)]
(println i*)
(when-not (zero? (mod i* 6))
(recur i*))))

View file

@ -0,0 +1,4 @@
v = 0
do
console.log ++v
while v % 6

View file

@ -0,0 +1,4 @@
val = 0
loop
console.log ++val
break unless val % 6

View file

@ -0,0 +1,8 @@
<cfscript>
value = 0;
do
{
value += 1;
writeOutput( value );
} while( value % 6 != 0 );
</cfscript>

View file

@ -0,0 +1,7 @@
50 rem does not have do-while simultate using for-next
100 x=0
120 for b=-1 to 0 step 0
130 x=x+1
140 print x
150 b=x/6<>int(x/6)
160 next x

View file

@ -0,0 +1,5 @@
(let ((val 0))
(loop do
(incf val)
(print val)
while (/= 0 (mod val 6))))

View file

@ -0,0 +1,3 @@
(loop with val = 0
do (print (incf val))
until (= 0 (mod val 6)))

View file

@ -0,0 +1,4 @@
(do* ((a 0) ; Initialize to 0
(b (incf a) (incf b))) ; Set first increment and increment on every loop
((zerop (mod b 6)) (print b)) ; Break condition and print last value `6' (right?)
(print b)) ; On every loop print value

View file

@ -0,0 +1,9 @@
import std.stdio;
void main() {
int val;
do {
val++;
write(val, " ");
} while (val % 6 != 0);
}

View file

@ -0,0 +1,2 @@
[1+$.' ,]⇒A {operator definition: PUSH 1, ADD, DUP, print top of stack to SDTOUT, print whitespace}
[1+$.' ,]a: {function definition}

View file

@ -0,0 +1,2 @@
[1+$.' ,]⇒A
0 A[$6/%][A]# {PUSH 0, execute operator A, [DUP, PUSH 6, MOD/DIV, POP][execute operator A]#}

View file

@ -0,0 +1,2 @@
[1+$.' ,]a:
0 a;![$6/%][a;!]#

View file

@ -0,0 +1 @@
1 2 3 4 5 6

View file

@ -0,0 +1,6 @@
var i := 0;
repeat
Inc(i);
PrintLn(i);
until i mod 6 = 0;

View file

@ -0,0 +1,7 @@
void main() {
int val = 0;
do {
val++;
print(val);
} while (val % 6 != 0);
}

View file

@ -0,0 +1,8 @@
0 si [i = 0]sz
[2Q]sA [A = code to break loop]sz
[
li 1 + p [print it = i + 1]sz
d si [i = it, leave it on stack]sz
6 % 0 =A [call A if 0 == it % 6]sz
0 0 =B [continue loop]sz
]sB 0 0 =B

View file

@ -0,0 +1,16 @@
program Loop;
{$APPTYPE CONSOLE}
var
I: Integer;
begin
I:= 0;
repeat
Inc(I);
Write(I:2);
until I mod 6 = 0;
Writeln;
Readln;
end.

View file

@ -0,0 +1,9 @@
proc nonrec main() void:
byte i;
i := 0;
while
i := i + 1;
write(i:2);
i % 6 ~= 0
do od
corp

View file

@ -0,0 +1,5 @@
val = 0
do{
val++
showln val
}while(val % 6 != 0)

View file

@ -0,0 +1,7 @@
var x = 0
do
{
x += 1
print(x)
} while x % 6 != 0

View file

@ -0,0 +1,6 @@
var x := 0
__loop(fn {
x += 1
println(x)
x % 6 != 0 # this is the return value of the function
})

View file

@ -0,0 +1,5 @@
A=0
REPEAT
A=A+1
PRINT(A)
UNTIL A MOD 6=0 !UNTIL A-6*INT(A/6)=0 for C-64

View file

@ -0,0 +1,6 @@
value = 0
repeat
value += 1
print value
until not (value mod 6 <> 0)
.

View file

@ -0,0 +1,8 @@
open monad io
loop n | n % 6 == 0 = do return ()
| else = do
putStrLn (show n)
loop (n+1)
_ = loop 10 ::: IO

View file

@ -0,0 +1,10 @@
defmodule Loops do
def do_while(n) do
n1 = n + 1
IO.puts n1
if rem(n1, 6) == 0, do: :ok,
else: do_while(n1)
end
end
Loops.do_while(0)

View file

@ -0,0 +1,5 @@
(let ((val 0))
(while (progn
(setq val (1+ val))
(message "%d" val)
(/= 0 (mod val 6)))))

View file

@ -0,0 +1,5 @@
(let ((val 0) done)
(while (not done)
(setq val (1+ val))
(message "%d" val)
(setq done (zerop (mod val 6)))))

View file

@ -0,0 +1,11 @@
do() ->
do(0).
do(0) ->
io:fwrite( "0 " ),
do( 1 );
do(N) when N rem 6 =:= 0 ->
io:format("~w~n", [N]);
do(N) ->
io:fwrite( "~p ", [N] ),
do(N+1).

View file

@ -0,0 +1,12 @@
include std/console.e
include std/math.e
atom x = 0
loop do
x += 1
?x
until(mod(x,6)) = 0
end loop
if getc(0) then end if

View file

@ -0,0 +1,4 @@
let rec loop n =
printfn "%d " n
if (n+1)%6 > 0 then loop (n+1)
loop 0

View file

@ -0,0 +1 @@
Seq.initInfinite id |> Seq.takeWhile(fun n->n=0 || n%6>0) |> Seq.iter (fun n-> printfn "%d" n)

View file

@ -0,0 +1,2 @@
// Loops/Do-while. Nigel Galloway: February 14th., 2022
Seq.unfold(fun n->match n with Some n->let n=n+1 in Some(n,if n%6=0 then None else Some(n)) |_->None)(Some 0)|>Seq.iter(printfn "%d")

View file

@ -0,0 +1 @@
0 [ dup 6 mod 0 = not ] [ [ . ] [ 1 + ] bi ] do while drop

View file

@ -0,0 +1,13 @@
class Main
{
public static Void main ()
{
i := 0
while (true)
{
i += 1
echo (i)
if (i % 6 == 0) break // end loop on condition
}
}
}

View file

@ -0,0 +1,7 @@
: do-until
0
begin 1+
dup .
dup 6 mod 0=
until
drop ;

View file

@ -0,0 +1,6 @@
INTEGER :: i = 0
DO
i = i + 1
WRITE(*, *) i
IF (MOD(i, 6) == 0) EXIT
END DO

View file

@ -0,0 +1,15 @@
PROGRAM DOWHILE
C Initialize modulus and value.
INTEGER MODLUS, IVALUE
PARAMETER (MODLUS = 6)
IVALUE = 0
C FORTRAN 77 has no do-while structure -- not semantically. It is not
C difficult to simulate it using GOTO, however:
10 CONTINUE
IVALUE = IVALUE + 1
WRITE (*,*) IVALUE
IF (.NOT. (MOD(IVALUE, MODLUS) .EQ. 0)) GOTO 10
STOP
END

View file

@ -0,0 +1,7 @@
IVALUE = 0
10 CONTINUE
IVALUE=IVALUE+1
WRITE(6,301) IVALUE
301 FORMAT(I5)
IF(MOD(IVALUE,6).NE.0) GOTO 10
END

View file

@ -0,0 +1,7 @@
IVALUE = 0
10 IVALUE=IVALUE+1
WRITE 301,IVALUE
301 FORMAT(I5)
IF(IVALUE-IVALUE/6*6) 10,20,10
20 STOP
END

View file

@ -0,0 +1,15 @@
component loops_do_while
export Executable
var x:ZZ32 = 0
run() = label loop
while true do
x += 1
println(x)
if (x MOD 6) = 0
then exit loop
end
end
end loop
end

View file

@ -0,0 +1,9 @@
' FB 1.05. 0 Win64
Dim i As Integer = 0
Do
i += 1
Print i; " ";
Loop While i Mod 6 <> 0
Print
Sleep

View file

@ -0,0 +1,6 @@
n = 0
do
{
n = n + 1
println[n]
} while n mod 6 != 0

View file

@ -0,0 +1,10 @@
window 1
dim as long i
do
i++
print i
until ( i mod 6 == 0 )
HandleEvents

View file

@ -0,0 +1,5 @@
n := 0;
repeat
n := n + 1;
Print(n, "\n");
until RemInt(n, 6) = 0;

View file

@ -0,0 +1,7 @@
i = 0
do
{
i += 1
show_message(string(i))
}
until (i mod 6 = 0)

View file

@ -0,0 +1,8 @@
10 LET I% = 0
20 ' first iteration - before the WHILE
30 LET I% = I% + 1
40 PRINT I%
50 WHILE I% MOD 6 <> 0
60 LET I% = I% + 1
70 PRINT I%
80 WEND

View file

@ -0,0 +1,4 @@
10 LET I% = 0
20 LET I% = I% + 1
30 PRINT I%
40 IF I% MOD 6 <> 0 THEN GOTO 20

View file

@ -0,0 +1,9 @@
Public Sub Main()
Dim siCount As Short
Repeat
Inc siCount
Print siCount;;
Until siCount Mod 6 = 0
End

View file

@ -0,0 +1,14 @@
package main
import "fmt"
func main() {
var value int
for {
value++
fmt.Println(value)
if value%6 != 0 {
break
}
}
}

View file

@ -0,0 +1,11 @@
package main
import "fmt"
func main() {
var value int
for ok := true; ok; ok = value%6 != 0 {
value++
fmt.Println(value)
}
}

View file

@ -0,0 +1,27 @@
package main
import "fmt"
func main() {
// do-while loop 1
n1 := 2
for n1 < 6 {
n1 *= 2
}
fmt.Println(n1) // prt 8
// do-while loop 2
n2 := 2
for ok := true; ok; ok = n2%8 != 0 {
n2 *= 2
}
fmt.Println(n2) // prt 8
// do-while loop 3
n3 := 2
for {
n3 *= 2
if n3 >= 6 {
break
}
}
fmt.Println(n3) // prt 8
}

View file

@ -0,0 +1,5 @@
def i = 0
do {
i++
println i
} while (i % 6 != 0)

View file

@ -0,0 +1,6 @@
def i = 0
while (true) {
i++
println i
if (i % 6 == 0) break
}

View file

@ -0,0 +1,8 @@
LOCAL n := 0
DO WHILE .T.
? ++n
IF n % 6 == 0
EXIT
ENDIF
ENDDO

View file

@ -0,0 +1,5 @@
import Data.List
import Control.Monad
import Control.Arrow
doWhile p f n = (n:) $ takeWhile p $ unfoldr (Just.(id &&& f)) $ succ n

View file

@ -0,0 +1,7 @@
*Main> mapM_ print $ doWhile ((/=0).(`mod`6)) succ 0
0
1
2
3
4
5

View file

@ -0,0 +1,7 @@
main :: IO ()
main =
mapM_ print . reverse $
until
(\(x:_) -> (x > 0) && (mod x 6 == 0))
(\xs@(x:_) -> succ x : xs)
[0]

View file

@ -0,0 +1,10 @@
import Data.IORef
import Control.Monad.Loops
main = do
x <- newIORef 0;
iterateWhile (\val -> val `mod` 6 /= 0 ) $ do
modifyIORef x (+1)
val <- readIORef x
print val
return val

View file

@ -0,0 +1,6 @@
var val = 0;
do {
val++;
Sys.println(val);
} while( val % 6 != 0);

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