basic for loop + examples -> era3
This commit is contained in:
parent
dd7af341a3
commit
0bc8b2ef55
24 changed files with 222 additions and 201 deletions
|
|
@ -1,17 +1,8 @@
|
|||
|
||||
# calculate fibonacci numbers with a loop
|
||||
|
||||
x := 0
|
||||
|
||||
n := 1
|
||||
p := 1
|
||||
|
||||
while x < 100 {
|
||||
f := n + p
|
||||
|
||||
p = n
|
||||
n = f
|
||||
|
||||
write(f)
|
||||
x = x + 1
|
||||
(a, b) := (1, 0)
|
||||
for _ in 0..100 {
|
||||
(a, b) = (a + b, b)
|
||||
println(a)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue