Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
19
Task/Conditional-structures/EMal/conditional-structures.emal
Normal file
19
Task/Conditional-structures/EMal/conditional-structures.emal
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
int i = 19
|
||||
^|if–then–else|^
|
||||
if i > 18
|
||||
writeLine("greater than 18")
|
||||
else
|
||||
writeLine("less or equal to 18")
|
||||
end
|
||||
^|else if|^
|
||||
if i == 18 do writeLine("equal to 18")
|
||||
else if i < 18 do writeLine("less than 18")
|
||||
else do writeLine("greater than 18")
|
||||
end
|
||||
^|when expression: just like iif in Visual Basic|^
|
||||
writeLine(when(i > 18, "greater than 18", "less or equal to 18"))
|
||||
^|hash-based conditionals|^
|
||||
Map dispatch = int%fun[
|
||||
18 => <|writeLine("equal to 18"),
|
||||
19 => <|writeLine("yeah, it's 19")]
|
||||
if dispatch.has(i) do dispatch[i]() end
|
||||
Loading…
Add table
Add a link
Reference in a new issue