[ create a new paste ] login | about

Link: http://codepad.org/d94Z9BFs    [ raw code | fork ]

fgtrjhyu - Plain Text, pasted on Dec 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
cat<<EOF
fib = coroutine.create(function ()
       a, b, c = 0, 1, true
       while c do
         c = coroutine.yield(a)
         a, b = b, a + b
       end
     end)

x, y = coroutine.resume(fib)
while x and y < 100 do
  print(y)
  x, y = coroutine.resume(fib, true)
end
coroutine.resume(fib, false)
EOF
}

lua <(lu)


Create a new paste based on this one


Comments: