Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
2
Task/Include-a-file/V-(Vlang)/include-a-file-1.v
Normal file
2
Task/Include-a-file/V-(Vlang)/include-a-file-1.v
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
cd ~/code/modules
|
||||
mkdir mymodule
|
||||
6
Task/Include-a-file/V-(Vlang)/include-a-file-2.v
Normal file
6
Task/Include-a-file/V-(Vlang)/include-a-file-2.v
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module mymodule
|
||||
|
||||
// To export a function we have to use 'pub'
|
||||
pub fn say_hi() {
|
||||
println('hello from mymodule!')
|
||||
}
|
||||
6
Task/Include-a-file/V-(Vlang)/include-a-file-3.v
Normal file
6
Task/Include-a-file/V-(Vlang)/include-a-file-3.v
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
module mymodule
|
||||
|
||||
pub fn say_hi_and_bye() {
|
||||
say_hi() // from myfile.v
|
||||
println('goodbye from mymodule')
|
||||
}
|
||||
6
Task/Include-a-file/V-(Vlang)/include-a-file-4.v
Normal file
6
Task/Include-a-file/V-(Vlang)/include-a-file-4.v
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import mymodule // name of module in those files
|
||||
|
||||
fn main() {
|
||||
mymodule.say_hi() // function from file 1 (myfile.v)
|
||||
mymodule.say_hi_and_bye() // function from file 2 (myfile2.v)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue