Browse Source

Add len() std function

github-actions
Garrit Franke 3 years ago
parent
commit
2fce143a31
  1. 10
      lib/stdio.sb

10
lib/stdio.sb

@ -8,3 +8,13 @@ fn print(msg) {
fn println(msg) {
print(msg + "\n")
}
// Prints the size of an array
fn len(arr) {
let c = 0
while arr[c] {
c = c + 1
}
return c
}
Loading…
Cancel
Save