A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
1
Task/Loops-Do-while/0DESCRIPTION
Normal file
1
Task/Loops-Do-while/0DESCRIPTION
Normal file
|
|
@ -0,0 +1 @@
|
|||
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.
|
||||
4
Task/Loops-Do-while/1META.yaml
Normal file
4
Task/Loops-Do-while/1META.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
category:
|
||||
- Conditional loops
|
||||
note: Iteration
|
||||
18
Task/Loops-Do-while/6502-Assembly/loops-do-while.6502
Normal file
18
Task/Loops-Do-while/6502-Assembly/loops-do-while.6502
Normal 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
|
||||
5
Task/Loops-Do-while/ALGOL-68/loops-do-while.alg
Normal file
5
Task/Loops-Do-while/ALGOL-68/loops-do-while.alg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
FOR value WHILE
|
||||
print(value);
|
||||
# WHILE # value MOD 6 /= 0 DO
|
||||
SKIP
|
||||
OD
|
||||
7
Task/Loops-Do-while/AWK/loops-do-while.awk
Normal file
7
Task/Loops-Do-while/AWK/loops-do-while.awk
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
BEGIN {
|
||||
val = 0
|
||||
do {
|
||||
val++
|
||||
print val
|
||||
} while( val % 6 != 0)
|
||||
}
|
||||
5
Task/Loops-Do-while/ActionScript/loops-do-while.as
Normal file
5
Task/Loops-Do-while/ActionScript/loops-do-while.as
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var val:int = 0;
|
||||
do
|
||||
{
|
||||
trace(++val);
|
||||
} while (val % 6);
|
||||
5
Task/Loops-Do-while/Ada/loops-do-while-1.ada
Normal file
5
Task/Loops-Do-while/Ada/loops-do-while-1.ada
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
loop
|
||||
Value := Value + 1;
|
||||
Put (Value);
|
||||
exit when Value mod 6 = 0;
|
||||
end loop;
|
||||
4
Task/Loops-Do-while/Ada/loops-do-while-2.ada
Normal file
4
Task/Loops-Do-while/Ada/loops-do-while-2.ada
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for Value in 0..Integer'Last loop
|
||||
Put (Value);
|
||||
exit when Value mod 6 = 0;
|
||||
end loop;
|
||||
8
Task/Loops-Do-while/Aime/loops-do-while.aime
Normal file
8
Task/Loops-Do-while/Aime/loops-do-while.aime
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
integer a;
|
||||
|
||||
a = 0;
|
||||
do {
|
||||
a += 1;
|
||||
o_integer(a);
|
||||
o_byte('\n');
|
||||
} while (a % 6 != 0);
|
||||
7
Task/Loops-Do-while/AmigaE/loops-do-while.amiga
Normal file
7
Task/Loops-Do-while/AmigaE/loops-do-while.amiga
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
PROC main()
|
||||
DEF i = 0
|
||||
REPEAT
|
||||
i := i + 1
|
||||
WriteF('\d\n', i)
|
||||
UNTIL Mod(i, 6) = 0
|
||||
ENDPROC
|
||||
3
Task/Loops-Do-while/AutoHotkey/loops-do-while.ahk
Normal file
3
Task/Loops-Do-while/AutoHotkey/loops-do-while.ahk
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
While mod(A_Index, 6) ;comment:everything but 0 is considered true
|
||||
output = %output%`n%A_Index%
|
||||
MsgBox % output
|
||||
5
Task/Loops-Do-while/BASIC/loops-do-while.bas
Normal file
5
Task/Loops-Do-while/BASIC/loops-do-while.bas
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
a = 0
|
||||
do
|
||||
a = a + 1
|
||||
print a
|
||||
loop while a mod 6 <> 0
|
||||
5
Task/Loops-Do-while/BBC-BASIC/loops-do-while.bbc
Normal file
5
Task/Loops-Do-while/BBC-BASIC/loops-do-while.bbc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
a = 0
|
||||
REPEAT
|
||||
a = a + 1
|
||||
PRINT a
|
||||
UNTIL a MOD 6 = 0
|
||||
3
Task/Loops-Do-while/Befunge/loops-do-while.bf
Normal file
3
Task/Loops-Do-while/Befunge/loops-do-while.bf
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
0>1+:.v
|
||||
|%6: <
|
||||
@
|
||||
5
Task/Loops-Do-while/C++/loops-do-while.cpp
Normal file
5
Task/Loops-Do-while/C++/loops-do-while.cpp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
int val = 0;
|
||||
do{
|
||||
val++;
|
||||
cout << val << endl;
|
||||
}while(val % 6 != 0);
|
||||
5
Task/Loops-Do-while/C/loops-do-while.c
Normal file
5
Task/Loops-Do-while/C/loops-do-while.c
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
int val = 0;
|
||||
do{
|
||||
val++;
|
||||
printf("%d\n",val);
|
||||
}while(val % 6 != 0);
|
||||
5
Task/Loops-Do-while/Clojure/loops-do-while.clj
Normal file
5
Task/Loops-Do-while/Clojure/loops-do-while.clj
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(loop [i 0]
|
||||
(let [i* (inc i)]
|
||||
(println i*)
|
||||
(when-not (zero? (mod i* 6))
|
||||
(recur i*))))
|
||||
4
Task/Loops-Do-while/CoffeeScript/loops-do-while.coffee
Normal file
4
Task/Loops-Do-while/CoffeeScript/loops-do-while.coffee
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
val = 0
|
||||
loop
|
||||
console.log ++val
|
||||
break unless val % 6
|
||||
8
Task/Loops-Do-while/ColdFusion/loops-do-while.cfm
Normal file
8
Task/Loops-Do-while/ColdFusion/loops-do-while.cfm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<cfscript>
|
||||
value = 0;
|
||||
do
|
||||
{
|
||||
value += 1;
|
||||
writeOutput( value );
|
||||
} while( value % 6 != 0 );
|
||||
</cfscript>
|
||||
5
Task/Loops-Do-while/Common-Lisp/loops-do-while-1.lisp
Normal file
5
Task/Loops-Do-while/Common-Lisp/loops-do-while-1.lisp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(setq val 0)
|
||||
(loop do
|
||||
(incf val)
|
||||
(print val)
|
||||
while (/= 0 (mod val 6)))
|
||||
3
Task/Loops-Do-while/Common-Lisp/loops-do-while-2.lisp
Normal file
3
Task/Loops-Do-while/Common-Lisp/loops-do-while-2.lisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(loop with val = 0
|
||||
do (print (incf val))
|
||||
until (= 0 (mod val 6)))
|
||||
9
Task/Loops-Do-while/D/loops-do-while.d
Normal file
9
Task/Loops-Do-while/D/loops-do-while.d
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import std.stdio;
|
||||
|
||||
void main() {
|
||||
int val;
|
||||
do {
|
||||
val++;
|
||||
write(val, " ");
|
||||
} while (val % 6 != 0);
|
||||
}
|
||||
6
Task/Loops-Do-while/DWScript/loops-do-while.dwscript
Normal file
6
Task/Loops-Do-while/DWScript/loops-do-while.dwscript
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var i := 0;
|
||||
|
||||
repeat
|
||||
Inc(i);
|
||||
PrintLn(i);
|
||||
until i mod 6 = 0;
|
||||
16
Task/Loops-Do-while/Delphi/loops-do-while.delphi
Normal file
16
Task/Loops-Do-while/Delphi/loops-do-while.delphi
Normal 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.
|
||||
6
Task/Loops-Do-while/E/loops-do-while.e
Normal file
6
Task/Loops-Do-while/E/loops-do-while.e
Normal 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
|
||||
})
|
||||
5
Task/Loops-Do-while/Ela/loops-do-while.ela
Normal file
5
Task/Loops-Do-while/Ela/loops-do-while.ela
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
open console
|
||||
|
||||
loop n | n % 6 == 0 = out ()
|
||||
| else = out `seq` loop (n+1)
|
||||
where out = & writen n
|
||||
9
Task/Loops-Do-while/Erlang/loops-do-while.erl
Normal file
9
Task/Loops-Do-while/Erlang/loops-do-while.erl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
do() ->
|
||||
io:format("0~n"),
|
||||
do(1).
|
||||
|
||||
do(N) when N rem 6 =:= 0 ->
|
||||
io:format("~w~n", [N]);
|
||||
do(N) ->
|
||||
io:format("~w~n", [N]),
|
||||
do(N+1).
|
||||
1
Task/Loops-Do-while/Factor/loops-do-while.factor
Normal file
1
Task/Loops-Do-while/Factor/loops-do-while.factor
Normal file
|
|
@ -0,0 +1 @@
|
|||
0 [ dup 6 mod 0 = not ] [ [ . ] [ 1 + ] bi ] do while drop
|
||||
13
Task/Loops-Do-while/Fantom/loops-do-while.fantom
Normal file
13
Task/Loops-Do-while/Fantom/loops-do-while.fantom
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Task/Loops-Do-while/Forth/loops-do-while.fth
Normal file
7
Task/Loops-Do-while/Forth/loops-do-while.fth
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
: do-until
|
||||
0
|
||||
begin 1+
|
||||
dup .
|
||||
dup 6 mod 0=
|
||||
until
|
||||
drop ;
|
||||
6
Task/Loops-Do-while/Fortran/loops-do-while-1.f
Normal file
6
Task/Loops-Do-while/Fortran/loops-do-while-1.f
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
INTEGER :: i = 0
|
||||
DO
|
||||
i = i + 1
|
||||
WRITE(*, *) i
|
||||
IF (MOD(i, 6) == 0) EXIT
|
||||
END DO
|
||||
15
Task/Loops-Do-while/Fortran/loops-do-while-2.f
Normal file
15
Task/Loops-Do-while/Fortran/loops-do-while-2.f
Normal 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
|
||||
7
Task/Loops-Do-while/GML/loops-do-while.gml
Normal file
7
Task/Loops-Do-while/GML/loops-do-while.gml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
i = 0
|
||||
do
|
||||
{
|
||||
i += 1
|
||||
show_message(string(i))
|
||||
}
|
||||
until (i mod 6 = 0)
|
||||
13
Task/Loops-Do-while/Go/loops-do-while.go
Normal file
13
Task/Loops-Do-while/Go/loops-do-while.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
for value := 0;; {
|
||||
value++
|
||||
fmt.Println(value)
|
||||
if value % 6 == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Task/Loops-Do-while/Groovy/loops-do-while.groovy
Normal file
6
Task/Loops-Do-while/Groovy/loops-do-while.groovy
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def i = 0
|
||||
while (true) {
|
||||
i++
|
||||
println i
|
||||
if ( i % 6 == 0) break
|
||||
}
|
||||
5
Task/Loops-Do-while/Haskell/loops-do-while-1.hs
Normal file
5
Task/Loops-Do-while/Haskell/loops-do-while-1.hs
Normal 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
|
||||
7
Task/Loops-Do-while/Haskell/loops-do-while-2.hs
Normal file
7
Task/Loops-Do-while/Haskell/loops-do-while-2.hs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
*Main> mapM_ print $ doWhile ((/=0).(`mod`6)) succ 0
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
8
Task/Loops-Do-while/Icon/loops-do-while.icon
Normal file
8
Task/Loops-Do-while/Icon/loops-do-while.icon
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
procedure main()
|
||||
|
||||
i := 0
|
||||
repeat {
|
||||
write(i +:= 1)
|
||||
if i % 6 = 0 then break
|
||||
}
|
||||
end
|
||||
11
Task/Loops-Do-while/J/loops-do-while.j
Normal file
11
Task/Loops-Do-while/J/loops-do-while.j
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
3 : 0 ] 0
|
||||
|
||||
NB. The 'st' in 'whilst' stands for 'skip test'
|
||||
|
||||
whilst. 0 ~: 6 | y do.
|
||||
y 1!:2 ]2
|
||||
y =. y+1
|
||||
end.
|
||||
|
||||
i.0 0
|
||||
)
|
||||
5
Task/Loops-Do-while/Java/loops-do-while.java
Normal file
5
Task/Loops-Do-while/Java/loops-do-while.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
int val = 0;
|
||||
do{
|
||||
val++;
|
||||
System.out.println(val);
|
||||
}while(val % 6 != 0);
|
||||
4
Task/Loops-Do-while/JavaScript/loops-do-while.js
Normal file
4
Task/Loops-Do-while/JavaScript/loops-do-while.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
var val = 0;
|
||||
do {
|
||||
print(++val);
|
||||
} while (val % 6);
|
||||
5
Task/Loops-Do-while/Liberty-BASIC/loops-do-while.liberty
Normal file
5
Task/Loops-Do-while/Liberty-BASIC/loops-do-while.liberty
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
a = 0
|
||||
do
|
||||
a =a +1
|
||||
print a
|
||||
loop until ( a mod 6) = 0
|
||||
7
Task/Loops-Do-while/Lisaac/loops-do-while.lisaac
Normal file
7
Task/Loops-Do-while/Lisaac/loops-do-while.lisaac
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
+ val : INTEGER;
|
||||
{
|
||||
val := val + 1;
|
||||
val.print;
|
||||
'\n'.print;
|
||||
val % 6 != 0
|
||||
}.while_do { };
|
||||
10
Task/Loops-Do-while/Logo/loops-do-while.logo
Normal file
10
Task/Loops-Do-while/Logo/loops-do-while.logo
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
make "val 0
|
||||
do.while [make "val :val + 1 print :val] [notequal? 0 modulo :val 6]
|
||||
do.until [make "val :val + 1 print :val] [equal? 0 modulo :val 6]
|
||||
|
||||
to my.loop :n
|
||||
make "n :n + 1
|
||||
print :n
|
||||
if notequal? 0 modulo :n 6 [my.loop :n]
|
||||
end
|
||||
my.loop 0
|
||||
5
Task/Loops-Do-while/Lua/loops-do-while.lua
Normal file
5
Task/Loops-Do-while/Lua/loops-do-while.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
i=0
|
||||
repeat
|
||||
i=i+1
|
||||
print(i)
|
||||
until i%6 == 0
|
||||
6
Task/Loops-Do-while/MATLAB/loops-do-while.m
Normal file
6
Task/Loops-Do-while/MATLAB/loops-do-while.m
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
a=0;
|
||||
while (1)
|
||||
a = a+1;
|
||||
disp(a);
|
||||
if (~mod(a,6)) break; end;
|
||||
end;
|
||||
7
Task/Loops-Do-while/MAXScript/loops-do-while.max
Normal file
7
Task/Loops-Do-while/MAXScript/loops-do-while.max
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
a = 0
|
||||
do
|
||||
(
|
||||
print a
|
||||
a += 1
|
||||
)
|
||||
while mod a 6 != 0
|
||||
8
Task/Loops-Do-while/Maple/loops-do-while.maple
Normal file
8
Task/Loops-Do-while/Maple/loops-do-while.maple
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
val := 0:
|
||||
do
|
||||
val := 1 + val;
|
||||
print( val );
|
||||
if irem( val, 6 ) = 0 then
|
||||
break
|
||||
end if;
|
||||
end do:
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
value = 5;
|
||||
NestWhile[
|
||||
# + 1 &
|
||||
,
|
||||
value
|
||||
, (Print[#]; Mod[#, 6] != 0) &
|
||||
];
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
5
|
||||
6
|
||||
1
Task/Loops-Do-while/Maxima/loops-do-while.maxima
Normal file
1
Task/Loops-Do-while/Maxima/loops-do-while.maxima
Normal file
|
|
@ -0,0 +1 @@
|
|||
block([n: 0], do (ldisp(n: n + 1), if mod(n, 6) = 0 then return('done)))$
|
||||
3
Task/Loops-Do-while/Metafont/loops-do-while.metafont
Normal file
3
Task/Loops-Do-while/Metafont/loops-do-while.metafont
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
a := 0;
|
||||
forever: show a; a := a + 1; exitif a mod 6 = 0; endfor
|
||||
end
|
||||
14
Task/Loops-Do-while/Modula-2/loops-do-while.mod2
Normal file
14
Task/Loops-Do-while/Modula-2/loops-do-while.mod2
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
MODULE DoWhile;
|
||||
IMPORT InOut;
|
||||
|
||||
VAR
|
||||
i: INTEGER;
|
||||
|
||||
BEGIN
|
||||
i := 0
|
||||
REPEAT
|
||||
InOut.WriteInt(i, 1);
|
||||
InOut.WriteLn;
|
||||
INC(i)
|
||||
UNTIL i MOD 6 = 0;
|
||||
END DoWhile.
|
||||
4
Task/Loops-Do-while/Modula-3/loops-do-while.mod3
Normal file
4
Task/Loops-Do-while/Modula-3/loops-do-while.mod3
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
REPEAT
|
||||
i := i + 1;
|
||||
IO.Put(Fmt.Int(i));
|
||||
UNTIL i MOD 6 = 0;
|
||||
5
Task/Loops-Do-while/PHP/loops-do-while.php
Normal file
5
Task/Loops-Do-while/PHP/loops-do-while.php
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
$val = 0;
|
||||
do {
|
||||
$val++;
|
||||
print "$val\n";
|
||||
} while ($val % 6 != 0);
|
||||
5
Task/Loops-Do-while/Perl/loops-do-while-1.pl
Normal file
5
Task/Loops-Do-while/Perl/loops-do-while-1.pl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
my $val = 0;
|
||||
do {
|
||||
$val++;
|
||||
print "$val\n";
|
||||
} while ($val % 6);
|
||||
5
Task/Loops-Do-while/Perl/loops-do-while-2.pl
Normal file
5
Task/Loops-Do-while/Perl/loops-do-while-2.pl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
my $val = 0;
|
||||
do {
|
||||
$val++;
|
||||
print "$val\n";
|
||||
} until ($val % 6 == 0);
|
||||
4
Task/Loops-Do-while/PicoLisp/loops-do-while-1.l
Normal file
4
Task/Loops-Do-while/PicoLisp/loops-do-while-1.l
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(let Val 0
|
||||
(loop
|
||||
(println (inc 'Val))
|
||||
(T (=0 (% Val 6))) ) )
|
||||
2
Task/Loops-Do-while/PicoLisp/loops-do-while-2.l
Normal file
2
Task/Loops-Do-while/PicoLisp/loops-do-while-2.l
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(let Val 0
|
||||
(until (=0 (% (println (inc 'Val)) 6))) )
|
||||
1
Task/Loops-Do-while/PicoLisp/loops-do-while-3.l
Normal file
1
Task/Loops-Do-while/PicoLisp/loops-do-while-3.l
Normal file
|
|
@ -0,0 +1 @@
|
|||
(for (Val 0 (n0 (% (println (inc 'Val)) 6))))
|
||||
14
Task/Loops-Do-while/Prolog/loops-do-while.pro
Normal file
14
Task/Loops-Do-while/Prolog/loops-do-while.pro
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
% initial condition
|
||||
do(0):- write(0),nl,do(1).
|
||||
|
||||
% control condition
|
||||
do(V):- 0 is mod(V,6), !, fail.
|
||||
|
||||
% loop
|
||||
do(V) :-
|
||||
write(V),nl,
|
||||
Y is V + 1,
|
||||
do(Y).
|
||||
|
||||
wloop :-
|
||||
do(0).
|
||||
5
Task/Loops-Do-while/Python/loops-do-while-1.py
Normal file
5
Task/Loops-Do-while/Python/loops-do-while-1.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
val = 0
|
||||
while True:
|
||||
val +=1
|
||||
print val
|
||||
if val % 6 == 0: break
|
||||
5
Task/Loops-Do-while/Python/loops-do-while-2.py
Normal file
5
Task/Loops-Do-while/Python/loops-do-while-2.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
val = 1
|
||||
print val
|
||||
while val % 6 != 0:
|
||||
val += 1
|
||||
print val
|
||||
7
Task/Loops-Do-while/R/loops-do-while.r
Normal file
7
Task/Loops-Do-while/R/loops-do-while.r
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
i <- 0
|
||||
repeat
|
||||
{
|
||||
i <- i + 1
|
||||
print(i)
|
||||
if(i %% 6 == 0) break
|
||||
}
|
||||
8
Task/Loops-Do-while/REXX/loops-do-while-1.rexx
Normal file
8
Task/Loops-Do-while/REXX/loops-do-while-1.rexx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/*REXX program to demonstrate a DO UNTIL construction. */
|
||||
|
||||
v=0
|
||||
do until v//6 == 0
|
||||
v=v+1
|
||||
say v
|
||||
end
|
||||
/*stick a fork in it, we're done.*/
|
||||
6
Task/Loops-Do-while/REXX/loops-do-while-2.rexx
Normal file
6
Task/Loops-Do-while/REXX/loops-do-while-2.rexx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/*REXX program to demonstrate a DO UNTIL construction. */
|
||||
|
||||
do v=1 until v//6==0
|
||||
say v
|
||||
end
|
||||
/*stick a fork in it, we're done.*/
|
||||
6
Task/Loops-Do-while/Racket/loops-do-while.rkt
Normal file
6
Task/Loops-Do-while/Racket/loops-do-while.rkt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#lang racket
|
||||
(let loop ([n 0])
|
||||
(set! n (+ n 1))
|
||||
(displayln n)
|
||||
(unless (zero? (remainder n 6))
|
||||
(loop n)))
|
||||
5
Task/Loops-Do-while/Ruby/loops-do-while-1.rb
Normal file
5
Task/Loops-Do-while/Ruby/loops-do-while-1.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
val = 0
|
||||
begin
|
||||
val += 1
|
||||
puts val
|
||||
end while val % 6 != 0
|
||||
5
Task/Loops-Do-while/Ruby/loops-do-while-2.rb
Normal file
5
Task/Loops-Do-while/Ruby/loops-do-while-2.rb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
val = 0
|
||||
begin
|
||||
val += 1
|
||||
puts val
|
||||
end until val % 6 == 0
|
||||
6
Task/Loops-Do-while/Ruby/loops-do-while-3.rb
Normal file
6
Task/Loops-Do-while/Ruby/loops-do-while-3.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
val = 0
|
||||
loop do
|
||||
val += 1
|
||||
puts val
|
||||
break unless val %6 != 0
|
||||
end
|
||||
6
Task/Loops-Do-while/Ruby/loops-do-while-4.rb
Normal file
6
Task/Loops-Do-while/Ruby/loops-do-while-4.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
val = 0
|
||||
loop do
|
||||
val += 1
|
||||
puts val
|
||||
break if val %6 == 0
|
||||
end
|
||||
10
Task/Loops-Do-while/Sather/loops-do-while.sa
Normal file
10
Task/Loops-Do-while/Sather/loops-do-while.sa
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class MAIN is
|
||||
main is
|
||||
val ::= 0;
|
||||
loop
|
||||
val := val + 1;
|
||||
#OUT + val + "\n";
|
||||
while!(val % 6 /= 0)
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
5
Task/Loops-Do-while/Scala/loops-do-while.scala
Normal file
5
Task/Loops-Do-while/Scala/loops-do-while.scala
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var x=0
|
||||
do {
|
||||
println(x)
|
||||
x+=1
|
||||
} while(x%6!=0)
|
||||
4
Task/Loops-Do-while/Scheme/loops-do-while.ss
Normal file
4
Task/Loops-Do-while/Scheme/loops-do-while.ss
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(let loop ((i 1))
|
||||
(display i)
|
||||
(if (positive? (modulo i 6))
|
||||
(loop (+ i 1))))
|
||||
6
Task/Loops-Do-while/Smalltalk/loops-do-while-1.st
Normal file
6
Task/Loops-Do-while/Smalltalk/loops-do-while-1.st
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|val|
|
||||
val := 0.
|
||||
[
|
||||
val := val + 1.
|
||||
val displayNl.
|
||||
] doWhile: [ (val rem: 6) ~= 0 ]
|
||||
6
Task/Loops-Do-while/Smalltalk/loops-do-while-2.st
Normal file
6
Task/Loops-Do-while/Smalltalk/loops-do-while-2.st
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|val|
|
||||
val := 0.
|
||||
[
|
||||
val := val + 1.
|
||||
val displayNl.
|
||||
] doUntil: [ (val rem: 6) == 0 ]
|
||||
7
Task/Loops-Do-while/Smalltalk/loops-do-while-3.st
Normal file
7
Task/Loops-Do-while/Smalltalk/loops-do-while-3.st
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|val|
|
||||
val := 0.
|
||||
[
|
||||
val := val + 1.
|
||||
val displayNl.
|
||||
(val rem: 6) ~= 0
|
||||
] whileTrue: [ ]
|
||||
18
Task/Loops-Do-while/Tcl/loops-do-while-1.tcl
Normal file
18
Task/Loops-Do-while/Tcl/loops-do-while-1.tcl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
proc do {body keyword expression} {
|
||||
if {$keyword eq "while"} {
|
||||
set expression "!($expression)"
|
||||
} elseif {$keyword ne "until"} {
|
||||
return -code error "unknown keyword \"$keyword\": must be until or while"
|
||||
}
|
||||
set condition [list expr $expression]
|
||||
while 1 {
|
||||
uplevel 1 $body
|
||||
if {[uplevel 1 $condition]} {
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
set i 0
|
||||
do {puts [incr i]} while {$i % 6 != 0}
|
||||
3
Task/Loops-Do-while/Tcl/loops-do-while-2.tcl
Normal file
3
Task/Loops-Do-while/Tcl/loops-do-while-2.tcl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
package require control
|
||||
set i 0; control::do {puts [incr i]} while {$i % 6 != 0}
|
||||
set i 0; control::do {puts [incr i]} until {$i % 6 == 0}
|
||||
5
Task/Loops-Do-while/Tcl/loops-do-while-3.tcl
Normal file
5
Task/Loops-Do-while/Tcl/loops-do-while-3.tcl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
set i 0
|
||||
while true {
|
||||
puts [incr i]
|
||||
if {$i % 6 == 0} break
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue