Insert code on 04_conditions directory
This commit is contained in:
parent
5abb3a7c14
commit
24feeebaee
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
|
||||||
|
pub fn main()
|
||||||
|
{
|
||||||
|
mut a := 10
|
||||||
|
mut b := 20
|
||||||
|
|
||||||
|
// Simple if structure
|
||||||
|
if a < b
|
||||||
|
{
|
||||||
|
println("${a} é menor do que ${b}")
|
||||||
|
}else if(a > b)
|
||||||
|
{
|
||||||
|
println("${a} é maior do que ${b}")
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
println("${a} é igual a ${b}")
|
||||||
|
}
|
||||||
|
|
||||||
|
num := 777
|
||||||
|
|
||||||
|
s := if num % 2 == 0 { 'even' } else { 'odd' }
|
||||||
|
println(s)
|
||||||
|
|
||||||
|
|
||||||
|
// ================================================================ //
|
||||||
|
|
||||||
|
m := {
|
||||||
|
'foor' : 'bar'
|
||||||
|
}
|
||||||
|
|
||||||
|
if v := m['foo']
|
||||||
|
{
|
||||||
|
println(v)
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
println('not found')
|
||||||
|
}
|
||||||
|
|
||||||
|
if c := res()
|
||||||
|
{
|
||||||
|
println(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn res() !int
|
||||||
|
{
|
||||||
|
return 42
|
||||||
|
}
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
pub fn main() {
|
|
||||||
println('oi')
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
pub fn main()
|
||||||
|
{
|
||||||
|
println('oi')
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue