$SPAD/src/input loop.input

The Axiom Team December 3, 2016

Abstract

Contents

2

— * —

-- Input for page BasicLoops
)clear all
p := 2**(2**3) + 1
repeat if prime?(p := p + 1) then leave
p
repeat if prime?(p := p + 1) then leave p
-- Input for page NestedLoops
)clear all
for i in 1..2 repeat for j in 3..4 repeat print [i,j]
i := 1
while i < 3 repeat (for j in 3..4 repeat print [i,j]; i := i + 1)
-- Input for page ParallelLoops
)clear all
for i in 1..5 for j in 11..20 repeat print [i,j]
for i in 1..5 for j in 11.. | even? j repeat print [i,j]
for i in 1.. for j in 11.. | even? j while i < 6 repeat print [i,j]
-- Input for page Loops
)clear all
i := 2
repeat (print (i := 2**i; if i > 10 then leave))
for j in 1..5 repeat print (i := j**i)
while i < 1000 repeat print (i := 2**i)
for i in 1.. while i < 1000 repeat print [j,": ",i := 2**i]
for j in 1..4 repeat for i in 2..4 repeat print [i,"**",j," = ",i**j]
-- Input for page ForLoops
)clear all
for i in 0..10 repeat print (i**3)
for i in 0..10 by 2 repeat print (i**3)
for i in 10..0 by -2 repeat print (i**3)
for i in 0..10 | even? i repeat print (i**3)
for i in 0.. by 2 repeat (i**3)

———-

References^{[1] nothing}

4