mirror of
https://github.com/bearlanguageorg/bear.git
synced 2026-08-26 15:37:18 +00:00
Enum methods and more
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// math_utils.vr — a small utility library for the import example
|
||||
|
||||
fn add(a, b) {
|
||||
return a + b
|
||||
}
|
||||
|
||||
fn multiply(a, b) {
|
||||
return a * b
|
||||
}
|
||||
|
||||
fn factorial(n) {
|
||||
if n <= 1 {
|
||||
return 1
|
||||
}
|
||||
return n * factorial(n - 1)
|
||||
}
|
||||
|
||||
fn fibonacci(n) {
|
||||
if n <= 1 {
|
||||
return n
|
||||
}
|
||||
return fibonacci(n - 1) + fibonacci(n - 2)
|
||||
}
|
||||
Reference in New Issue
Block a user