2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1 +1,2 @@
Demonstrate a for-loop where the step-value is greater than one.
<br><br>

View file

@ -0,0 +1,20 @@
* Loops/For with a specified step 12/08/2015
LOOPFORS CSECT
USING LOOPFORS,R12
LR R12,R15
* == Algol style ================ test at the beginning
LA R3,BUF idx=0
LA R5,0 from 5 (from-step=0)
LA R6,5 step 5
LA R7,25 to 25
LOOPI BXH R5,R6,ELOOPI for i=5 to 25 step 5
XDECO R5,XDEC edit i
MVC 0(4,R3),XDEC+8 output i
LA R3,4(R3) idx=idx+4
B LOOPI next i
ELOOPI XPRNT BUF,80 print buffer
BR R14
BUF DC CL80' ' buffer
XDEC DS CL12 temp for edit
YREGS
END LOOPFORS

View file

@ -0,0 +1,10 @@
* == Fortran style ============== test at the end
LA R3,BUF idx=0
LA R5,5 from 5
LA R6,5 step 5
LA R7,25 to 25
LOOPJ XDECO R5,XDEC for j=5 to 25 step 5; edit j
MVC 0(4,R3),XDEC+8 output j
LA R3,4(R3) idx=idx+4
BXLE R5,R6,LOOPJ next j
XPRNT BUF,80 print buffer

View file

@ -0,0 +1,12 @@
* == Algol style ================ test at the beginning
LA R3,BUF idx=0
LA R5,5 from 5
LA R6,5 step 5
LA R7,25 to 25
DO WHILE=(CR,R5,LE,R7) for i=5 to 25 step 5
XDECO R5,XDEC edit i
MVC 0(4,R3),XDEC+8 output i
LA R3,4(R3) idx=idx+4
AR R5,R6 i=i+step
ENDDO , next i
XPRNT BUF,80 print buffer

View file

@ -0,0 +1,8 @@
* == Fortran style ============== test at the end
LA R3,BUF idx=0
DO FROM=(R5,5),TO=(R7,25),BY=(R6,5) for i=5 to 25 step 5
XDECO R5,XDEC edit i
MVC 0(4,R3),XDEC+8 output i
LA R3,4(R3) idx=idx+4
ENDDO , next i
XPRNT BUF,80 print buffer

View file

@ -1,20 +0,0 @@
* Loops/For with a specified step 12/08/2015
LOOPFORS CSECT
USING LOOPFORS,R12
LR R12,R15
BEGIN LA R3,MVC
SR R5,R5 index
LA R6,5 step 5
LA R7,25 to 25
LOOPI BXH R5,R6,ELOOPI for i=5 to 25 step 5
XDECO R5,XDEC
MVC 0(4,R3),XDEC+8
LA R3,4(R3)
NEXTI B LOOPI next i
ELOOPI XPRNT MVC,80
XR R15,R15
BR R14
MVC DC CL80' '
XDEC DS CL12
YREGS
END LOOPFORS

View file

@ -0,0 +1,2 @@
FOR i:=5 UNTIL 25 STEP 5 DO
OUTINTEGER(i)

View file

@ -1,4 +1 @@
for i = 2 to 8 step 2
print i; ", ";
next i
print "who do we appreciate?"
FOR I = 2 TO 8 STEP 2 : PRINT I; ", "; : NEXT I : PRINT "WHO DO WE APPRECIATE?"

View file

@ -1 +1,4 @@
FOR I = 2 TO 8 STEP 2 : PRINT I; ", "; : NEXT I : PRINT "WHO DO WE APPRECIATE?"
for i = 2 to 8 step 2
print i; ", ";
next i
print "who do we appreciate?"

View file

@ -0,0 +1,10 @@
#import system.
#import extensions.
#symbol program =
[
2 to:8 &by:2 &doEach:i
[
console writeLine:i.
].
].

View file

@ -0,0 +1,4 @@
for(i,2,8,2,
write(i,", ")
)
write("who do we appreciate?")

View file

@ -0,0 +1 @@
cat(paste(c(seq(2, 8, by=2), "who do we appreciate?\n"), collapse=", "))

View file

@ -0,0 +1,4 @@
(do ((i 2 (+ i 2))) ; list of variables, initials and steps -- you can iterate over several at once
((>= i 9)) ; exit condition
(display i) ; body
(newline))

View file

@ -0,0 +1,5 @@
(let loop ((i 2)) ; function name, parameters and starting values
(cond ((< i 9)
(display i)
(newline)
(loop (+ i 2)))))) ; tail-recursive call, won't create a new stack frame

View file

@ -0,0 +1,11 @@
(define-syntax for-loop
(syntax-rules ()
((for-loop index start end step body ...)
(let ((evaluated-end end) (evaluated-step step))
(let loop ((i start))
(if (< i evaluated-end)
((lambda (index) body ... (loop (+ i evaluated-step))) i)))))))
(for-loop i 2 9 2
(display i)
(newline))

View file

@ -0,0 +1,4 @@
BEGIN
INTEGER i;
FOR i:=5 UNTIL 25 STEP 5 DO OutInt(i,5)
END

View file

@ -1,3 +1,5 @@
for (( x=2; $x<=8; x=$x+2 )); do
printf "%d, " $x
x=2
while [[$x -le 8]]; do
echo $x
((x=x+2))
done

View file

@ -1,4 +1,5 @@
for x in {2..8..2}
do
echo $x
x=2
while ((x<=8)); do
echo $x
((x+=2))
done

View file

@ -1,3 +1,3 @@
foreach x (`jot - 2 8 2`)
echo $x
end
for (( x=2; $x<=8; x=$x+2 )); do
printf "%d, " $x
done

View file

@ -0,0 +1,4 @@
for x in {2..8..2}
do
echo $x
done

View file

@ -0,0 +1,3 @@
foreach x (`jot - 2 8 2`)
echo $x
end

View file

@ -0,0 +1,6 @@
Sub MyLoop()
For i = 2 To 8 Step 2
Debug.Print i;
Next i
Debug.Print
End Sub

View file

@ -0,0 +1,5 @@
buffer=""
For i = 2 To 8 Step 2
buffer=buffer & i & " "
Next
wscript.echo buffer

View file

@ -0,0 +1,10 @@
Public Class FormPG
Private Sub FormPG_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim i As Integer, buffer As String
buffer = ""
For i = 2 To 8 Step 2
buffer = buffer & i & " "
Next i
Debug.Print(buffer)
End Sub
End Class

View file

@ -0,0 +1,6 @@
Sub MyLoop()
For i = 2 To 8 Step 2
Debug.Print i;
Next i
Debug.Print
End Sub