18 lines
426 B
Plaintext
18 lines
426 B
Plaintext
import File from "sys/file"
|
|
let fib = j => {
|
|
let mut fnow = 0, fnext = 1
|
|
for (let mut n = 0; n <= j; n += 1) {
|
|
if (n == 0 || n == 1) {
|
|
let output1 = " " ++ toString(n)
|
|
ignore(File.fdWrite(File.stdout, output1))
|
|
} else {
|
|
let tempf = fnow + fnext
|
|
fnow = fnext
|
|
fnext = tempf
|
|
let output2 = " " ++ toString(fnext)
|
|
ignore(File.fdWrite(File.stdout, output2))
|
|
}
|
|
}
|
|
}
|
|
fib(20)
|