Merge pull request #12 from viniciusfdasilva/dev

[31-12-2023] - Last pull request of the year! 🙃😝
This commit is contained in:
Vinicius Silva 2023-12-31 17:00:29 -03:00 committed by GitHub
commit 4ebb6eaaa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 0 deletions

9
13_functions/init.v Normal file
View File

@ -0,0 +1,9 @@
// init() can not be pub
fn init(){
println('oi')
}
pub fn main(){
init()
}

39
14_constants/constants.v Normal file
View File

@ -0,0 +1,39 @@
const pi = 3.14
const e = 2.71828
const world = '世界'
struct Color{
r int
g int
b int
}
fn rgb(r int, g int, b int) Color
{
return Color{
r: r
g: g
b: b
}
}
const numbers = [1,2,3]
const red = Color{
r: 255
g: 0
b: 0
}
const blue = rgb(0,0, 255)
pub fn main(){
println(pi)
println(world)
println(numbers)
println(red)
println(blue)
}

7
14_constants/module.v Normal file
View File

@ -0,0 +1,7 @@
module mymodule
pub const golden_ratio = 1.61803
fn calc(){
println(mymodule.golden_ratio)
}