Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,9 @@
// function that returns multiple values
fn foo() (int, int) {
return 2, 3
}
mut a, mut b := foo()
println("${a} and ${b}")
a, _ = foo() // to ignore particular returned values, use `_`
println(a)

View file

@ -0,0 +1,9 @@
// ignore values, while iterating over keys
m := {
'one': 1
'two': 2
}
for key, _ in m {
println(key)
}

View file

@ -0,0 +1,4 @@
// "it", used in filter and map
nums := [1, 2, 3, 4, 5, 6]
even := nums.filter(it % 2 == 0)
println(even)

View file

@ -0,0 +1,6 @@
// "a" and "b" in sorting arrays, used to provide custom sorting conditions
mut numbers := [1, 3, 2]
numbers.sort()
println(numbers)
numbers.sort(a > b) // reverse sort
println(numbers)