Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
9
Task/Topic-variable/V-(Vlang)/topic-variable-1.v
Normal file
9
Task/Topic-variable/V-(Vlang)/topic-variable-1.v
Normal 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, the `_` is used
|
||||
println(a)
|
||||
9
Task/Topic-variable/V-(Vlang)/topic-variable-2.v
Normal file
9
Task/Topic-variable/V-(Vlang)/topic-variable-2.v
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// ignore values, while iterating over keys
|
||||
m := {
|
||||
'one': 1
|
||||
'two': 2
|
||||
}
|
||||
|
||||
for key, _ in m {
|
||||
println(key)
|
||||
}
|
||||
4
Task/Topic-variable/V-(Vlang)/topic-variable-3.v
Normal file
4
Task/Topic-variable/V-(Vlang)/topic-variable-3.v
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// "it", used in filter and map
|
||||
words := ['hello', 'world']
|
||||
upper := words.map(it.to_upper())
|
||||
println(upper)
|
||||
Loading…
Add table
Add a link
Reference in a new issue