2 ms·
Yes, when is the way to do loops in this language. From the hidden examples page functi fibonacci (n) => { const var sum = 1! const var i = 0!
by pmontra 3y ago
Yes, when is the way to do loops in this language. From the hidden examples page
functi fibonacci (n) => {
const var sum = 1!
const var i = 0!
when (i < n) {
sum += sum + previous sum!
i++!
}
}
when (i < 10) {
fibonacci(i)?
i++!
}
- ravi-delia 3y agoAnd if you don't want your code to loop back by accident you can just use lifetimes! Truly an elegant language
- Doxin 3y agoOh please tell me you can specify the length of your loops in lines of code executed.
- ravi-delia 3y agovar var i<10> = 0!! var var i = false! when (i) { print(i)! i++! } I think this should print 0,1,2 and then stop, assuming checking the condition is a line of code, and that lifetimes are for lines executed and not just the syntax.