This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1 @@
Write a for loop which writes a countdown from 10 to 0.

View file

@ -0,0 +1,2 @@
---
note: Iteration

View file

@ -0,0 +1,38 @@
;An OS/hardware specific routine that is setup to display the Ascii character
;value contained in the Accumulator
Send = $9000 ;routine not implemented here
PrintNewLine = $9050 ;routine not implemented here
*= $8000 ;set base address
Start PHA ;push Accumulator and Y register onto stack
TYA
PHA
LDY #10 ;set Y register to loop start value
TYA ;place loop value in the Accumulator
Loop JSR PrintTwoDigits
JSR PrintNewLine
DEY ;decrement loop value
BPL Loop ;continue loop if sign flag is clear
PLA ;pop Y register and Accumulator off of stack
TAY
PLA
RTS ;exit
;Print value in Accumulator as two hex digits
PrintTwoDigits
PHA
LSR
LSR
LSR
LSR
JSR PrintDigit
PLA
AND #$0F
JSR PrintDigit
RTS
;Convert value in Accumulator to an Ascii hex digit
PrintDigit
ORA #$30
JSR Send ;routine not implemented here
RTS

View file

@ -0,0 +1,3 @@
FOR i FROM 10 BY -1 TO 0 DO
print((i,new line))
OD

View file

@ -0,0 +1,3 @@
FOR i FROM 10 DOWNTO 0 DO
print((i,new line))
OD

View file

@ -0,0 +1,5 @@
BEGIN {
for(i=10; i>=0; i--) {
print i
}
}

View file

@ -0,0 +1,3 @@
for I in reverse 0..10 loop
Put_Line(Integer'Image(I));
end loop;

View file

@ -0,0 +1,6 @@
PROC main()
DEF i
FOR i := 10 TO 0 STEP -1
WriteF('\d\n', i)
ENDFOR
ENDPROC

View file

@ -0,0 +1,7 @@
x := 10
While (x >= 0)
{
output .= "`n" . x
x--
}
MsgBox % output

View file

@ -0,0 +1,3 @@
for i = 10 to 0 step -1
print i
next i

View file

@ -0,0 +1,3 @@
FOR i% = 10 TO 0 STEP -1
PRINT i%
NEXT

View file

@ -0,0 +1,2 @@
55+>:.:v
^ -1_@

View file

@ -0,0 +1,2 @@
10:?i
& whl'(out$!i&!i+-1:~<0:?i)

View file

@ -0,0 +1 @@
10.to 0 { n | p n }

View file

@ -0,0 +1,2 @@
for(int i = 10; i >= 0; --i)
std::cout << i << "\n";

View file

@ -0,0 +1,3 @@
int i;
for(i = 10; i >= 0; --i)
printf("%d\n",i);

View file

@ -0,0 +1 @@
(doseq [x (range 10 -1 -1)] (println x))

View file

@ -0,0 +1,9 @@
# The more compact "array comprehension" style
console.log i for i in [10..0]
# The "regular" for loop style.
for i in [10..0]
console.log i
# More compact version of the above
for i in [10..0] then console.log i

View file

@ -0,0 +1,3 @@
<cfloop index = "i" from = "10" to = "0" step = "-1">
#i#
</cfloop>

View file

@ -0,0 +1,6 @@
<cfscript>
for( i = 10; i <= 0; i-- )
{
writeOutput( i );
}
</cfscript>

View file

@ -0,0 +1,2 @@
(loop for i from 10 downto 1 do
(print i))

View file

@ -0,0 +1,10 @@
import std.stdio: writeln;
void main() {
for (int i = 10; i >= 0; --i)
writeln(i);
writeln();
foreach_reverse (i ; 0 .. 10 + 1)
writeln(i);
}

View file

@ -0,0 +1,2 @@
for i := 10 downto 0 do
PrintLn(i);

View file

@ -0,0 +1 @@
for i in (0..10).descending() { println(i) }

View file

@ -0,0 +1,3 @@
for ( i int from 10 to 0 decrement by 1 )
SysLib.writeStdout( i );
end

View file

@ -0,0 +1,3 @@
open console imperative
each writen [10,9..0]

View file

@ -0,0 +1,2 @@
each f (x::xs) = f x $ each f xs
each _ [] = ()

View file

@ -0,0 +1,6 @@
open console
countDown m n | n < m = ()
| else = writen n $ countDown m (n-1)
countDown 0 10

View file

@ -0,0 +1,3 @@
for i = 10 to 0 by -1 do
? i
end for

View file

@ -0,0 +1 @@
10[$0>][$." "1-]#.

View file

@ -0,0 +1 @@
11 iota <reversed> [ . ] each

View file

@ -0,0 +1,10 @@
class DownwardFor
{
public static Void main ()
{
for (Int i := 10; i >= 0; i--)
{
echo (i)
}
}
}

View file

@ -0,0 +1 @@
: loop-down 0 10 do i . -1 +loop ;

View file

@ -0,0 +1,3 @@
DO i = 10, 0, -1
WRITE(*, *) i
END DO

View file

@ -0,0 +1,12 @@
PROGRAM DOWNWARDFOR
C Initialize the loop parameters.
INTEGER I, START, FINISH, STEP
PARAMETER (START = 10, FINISH = 0, STEP = -1)
C If you were to leave off STEP, it would default to positive one.
DO 10 I = START, FINISH, STEP
WRITE (*,*) I
10 CONTINUE
STOP
END

View file

@ -0,0 +1,2 @@
for(i = 10; i >= 0; i += 1)
show_message(string(i))

View file

@ -0,0 +1,3 @@
for i := 10; i >= 0; i-- {
fmt.Println(i)
}

View file

@ -0,0 +1,3 @@
for (i in (10..0)) {
println i
}

View file

@ -0,0 +1,2 @@
import Control.Monad
forM_ [10,9..0] print

View file

@ -0,0 +1,3 @@
DO i = 10, 0, -1
WRITE() i
ENDDO

View file

@ -0,0 +1 @@
for i=10,0,-1 do print,i

View file

@ -0,0 +1 @@
print,10-indgen(11)

View file

@ -0,0 +1,3 @@
every i := 10 to 0 by -1 do {
# things to do within the loop
}

View file

@ -0,0 +1,2 @@
for(i = 10: i >= 0: i--)
print i, "^";

View file

@ -0,0 +1,6 @@
3 : 0 ] 11
for_i. i. - y do.
i 1!:2 ]2
end.
i.0 0
)

View file

@ -0,0 +1,3 @@
for(i = 10; i >= 0; --i){
System.out.println(i);
}

View file

@ -0,0 +1 @@
for (var i=10; i>=0; --i) print(i);

View file

@ -0,0 +1,4 @@
for i = 10 to 0 step -1
print i
next i
end

View file

@ -0,0 +1,4 @@
10.downto 0 do { i : INTEGER;
i.println;
};

View file

@ -0,0 +1 @@
for [i 10 0] [print :i]

View file

@ -0,0 +1,3 @@
for i=10,0,-1 do
print(i)
end

View file

@ -0,0 +1,7 @@
define(`for',
`ifelse($#,0,``$0'',
`ifelse(eval($2 $3),1,
`pushdef(`$1',$2)$5`'popdef(`$1')$0(`$1',eval($2+$4),$3,$4,`$5')')')')dnl
for(`x',`10',`>=0',`-1',`x
')

View file

@ -0,0 +1,3 @@
for k = 10:-1:0,
printf('%d\n',k)
end;

View file

@ -0,0 +1 @@
printf('%d\n',10:-1:0);

View file

@ -0,0 +1 @@
for i in 10 to 0 by -1 do print i

View file

@ -0,0 +1,3 @@
LOOPDOWN
NEW I FOR I=10:-1:1 WRITE I WRITE:I'=1 ", "
KILL I QUIT

View file

@ -0,0 +1 @@
for i from 10 to 0 by -1 do print(i) end:

View file

@ -0,0 +1 @@
seq(print(i),i=10..0,-1)

View file

@ -0,0 +1 @@
For[i = 10, i >= 0, i--, Print[i]]

View file

@ -0,0 +1 @@
Do[Print[i], {i, 10, 0, -1}]

View file

@ -0,0 +1 @@
Scan[Print, Range[10, 0, -1]]

View file

@ -0,0 +1 @@
for i from 10 thru 0 step -1 do print(i);

View file

@ -0,0 +1,14 @@
:- module loops_downward_for.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module int.
main(!IO) :-
Print = (pred(I::in, !.IO::di, !:IO::uo) is det :-
io.write_int(I, !IO), io.nl(!IO)
),
int.fold_down(Print, 1, 10, !IO).

View file

@ -0,0 +1,2 @@
for i = 10 step -1 until 0: show i; endfor
end

View file

@ -0,0 +1 @@
for i = 10 downto 0: show i; endfor end

View file

@ -0,0 +1,12 @@
MODULE Downward;
IMPORT InOut;
VAR
i: INTEGER;
BEGIN
FOR i := 10 TO 0 BY -1 DO
InOut.WriteInt(i, 2);
InOut.WriteLn
END
END Downward.

View file

@ -0,0 +1,3 @@
FOR i := 10 TO 0 BY -1 DO
IO.PutInt(i);
END;

View file

@ -0,0 +1,2 @@
for ($i = 10; $i >= 0; $i--)
echo "$i\n";

View file

@ -0,0 +1,2 @@
foreach (range(10, 0) as $i)
echo "$i\n";

View file

@ -0,0 +1,3 @@
foreach (reverse 0..10) {
print "$_\n";
}

View file

@ -0,0 +1,2 @@
(for (I 10 (ge0 I) (dec I))
(println I) )

View file

@ -0,0 +1 @@
(mapc println (range 10 0))

View file

@ -0,0 +1,2 @@
for i in xrange(10, -1, -1):
print i

View file

@ -0,0 +1 @@
for(i in 10:0) {print(i)}

View file

@ -0,0 +1,3 @@
do j=10 to 0 by -1
say j
end

View file

@ -0,0 +1,3 @@
do j=10 by -1 to 0
say j
end

View file

@ -0,0 +1,4 @@
do j=10 by -2 to 0
say j
j=j+1 /*this increments the DO index. Do NOT program like this! */
end

View file

@ -0,0 +1,3 @@
do j=30 to 1 by -.25
say j
end

View file

@ -0,0 +1,4 @@
#lang racket
(for ([i (in-range 10 -1 -1)])
(displayln i))

View file

@ -0,0 +1,3 @@
10.downto(0) do |i|
puts i
end

View file

@ -0,0 +1,3 @@
++++++++++>++++++++++!/- @!\=@\.@@@-@-----# atoi
\n counter #\?>.</ \ @@@+@+++++# itoa
loop

View file

@ -0,0 +1,8 @@
class MAIN is
main is
i:INT;
loop i := 10.downto!(0);
#OUT + i + "\n";
end;
end;
end;

View file

@ -0,0 +1,3 @@
for(i <- 10 to 0 by -1) println(i)
//or
10 to 0 by -1 foreach println

View file

@ -0,0 +1,4 @@
(do ((i 10 (- i 1)))
((< i 0))
(display i)
(newline))

View file

@ -0,0 +1,4 @@
10 to: 1 by: -1 do:[:aNumber |
aNumber display.
Character space display.
]

View file

@ -0,0 +1,4 @@
for {set i 10} {$i >= 0} {incr i -1} {
puts $i
}
# puts "We have liftoff!"