mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
language: introduce the requirement to use return to return a value from a function
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
/* fibonacci sequence */
|
||||
func fib(n) {
|
||||
if n < 2 {
|
||||
return if n < 2 {
|
||||
n
|
||||
} else {
|
||||
fib(n - 1) + fib(n - 2)
|
||||
@ -8,6 +8,6 @@ func fib(n) {
|
||||
}
|
||||
|
||||
export func main() {
|
||||
let result = fib(30)
|
||||
let result = fib(20)
|
||||
println(result)
|
||||
}
|
||||
|
Reference in New Issue
Block a user