Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
32
Task/Loops-Continue/360-Assembly/loops-continue.360
Normal file
32
Task/Loops-Continue/360-Assembly/loops-continue.360
Normal 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
|
||||
|
|
@ -10,8 +10,6 @@ begin
|
|||
goto Continue;
|
||||
end if;
|
||||
Put (",");
|
||||
-- label must be followed by a statement.
|
||||
<<Continue>>
|
||||
null;
|
||||
<<Continue>> --Ada 2012 no longer requires a statement after the label
|
||||
end loop;
|
||||
end Loop_Continue;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
open console imperative
|
||||
open monad io
|
||||
|
||||
loop n | n > 10 = ()
|
||||
| else = rec write (show n) f `seq` loop (n+1)
|
||||
where f | n % 5 == 0 = "\r\n"
|
||||
| else = ", "
|
||||
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
|
||||
_ = loop 1 ::: IO
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
open console imperative
|
||||
open monad io
|
||||
|
||||
loop [] = ()
|
||||
loop (x::xs) = rec (write << show) x c `seq` loop xs
|
||||
where c | x % 5 == 0 = "\r\n"
|
||||
| else = ", "
|
||||
loop [] = return ()
|
||||
loop (x::xs) = do
|
||||
putStr (show x)
|
||||
putStr f
|
||||
loop xs
|
||||
where f | x % 5 == 0 = "\r\n"
|
||||
| else = ", "
|
||||
|
||||
loop [1..10]
|
||||
_ = loop [1..10] ::: IO
|
||||
|
|
|
|||
10
Task/Loops-Continue/Elixir/loops-continue.elixir
Normal file
10
Task/Loops-Continue/Elixir/loops-continue.elixir
Normal 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
|
||||
|
|
@ -4,18 +4,18 @@
|
|||
|
||||
main() ->
|
||||
for_loop(1).
|
||||
|
||||
for_loop(N) when N /= 5 , N <10 ->
|
||||
|
||||
for_loop(N) when N /= 5 , N <10 ->
|
||||
io:format("~p, ",[N] ),
|
||||
for_loop(N+1);
|
||||
for_loop(N+1);
|
||||
|
||||
for_loop(N) when N >=10->
|
||||
if N=:=10 ->
|
||||
if N=:=10 ->
|
||||
io:format("~p\n",[N] )
|
||||
end;
|
||||
|
||||
for_loop(N) ->
|
||||
if N=:=5 ->
|
||||
for_loop(N) ->
|
||||
if N=:=5 ->
|
||||
io:format("~p\n",[N] ),
|
||||
for_loop(N+1)
|
||||
end.
|
||||
|
|
|
|||
3
Task/Loops-Continue/Fortran/loops-continue-3.f
Normal file
3
Task/Loops-Continue/Fortran/loops-continue-3.f
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
WRITE (6,1) (I,I = 1,10)
|
||||
1 FORMAT (4(1X,I0,","),1X,I0)
|
||||
END
|
||||
11
Task/Loops-Continue/JavaScript/loops-continue-2.js
Normal file
11
Task/Loops-Continue/JavaScript/loops-continue-2.js
Normal 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');
|
||||
}, ''
|
||||
)
|
||||
);
|
||||
2
Task/Loops-Continue/JavaScript/loops-continue-3.js
Normal file
2
Task/Loops-Continue/JavaScript/loops-continue-3.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
1, 2, 3, 4, 5
|
||||
6, 7, 8, 9, 10
|
||||
8
Task/Loops-Continue/Julia/loops-continue.julia
Normal file
8
Task/Loops-Continue/Julia/loops-continue.julia
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for i in 1:10
|
||||
print(i)
|
||||
if i%5 == 0
|
||||
println()
|
||||
continue
|
||||
end
|
||||
print(", ")
|
||||
end
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
use std::iter::range_inclusive;
|
||||
|
||||
fn main() {
|
||||
for i in range_inclusive(1, 10) {
|
||||
print!("{:d}", i);
|
||||
if i % 5 == 0 {
|
||||
print("\n");
|
||||
continue;
|
||||
for i in 1..10+1 {
|
||||
print!("{}", i);
|
||||
if i % 5 == 0 {
|
||||
print!("\n");
|
||||
continue;
|
||||
}
|
||||
print!(", ");
|
||||
}
|
||||
print(", ");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
Task/Loops-Continue/Scilab/loops-continue.scilab
Normal file
8
Task/Loops-Continue/Scilab/loops-continue.scilab
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
for i=1:10
|
||||
printf("%2d ",i)
|
||||
if modulo(i,5)~=0 then
|
||||
printf(", ")
|
||||
continue
|
||||
end
|
||||
printf("\n")
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue