CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
|
|
@ -0,0 +1,60 @@
|
|||
show_if_with_parenthesis = fn (Num) {
|
||||
if (Num == 1) {
|
||||
io.format("is one~n")
|
||||
}
|
||||
else if (Num === 2) {
|
||||
io.format("is two~n")
|
||||
}
|
||||
else {
|
||||
io.format("not one not two~n")
|
||||
}
|
||||
}
|
||||
|
||||
show_if_without_parenthesis = fn (Num) {
|
||||
if Num == 1 {
|
||||
io.format("is one~n")
|
||||
}
|
||||
else if Num === 2 {
|
||||
io.format("is two~n")
|
||||
}
|
||||
else {
|
||||
io.format("not one not two~n")
|
||||
}
|
||||
}
|
||||
|
||||
show_switch_with_parenthesis = fn (Num) {
|
||||
switch (Num) {
|
||||
case (1) {
|
||||
io.format("one!~n")
|
||||
}
|
||||
case (2) {
|
||||
io.format("two!~n")
|
||||
}
|
||||
else {
|
||||
io.format("else~n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
show_switch_without_parenthesis = fn (Num) {
|
||||
switch (Num) {
|
||||
case 1 {
|
||||
io.format("one!~n")
|
||||
}
|
||||
case 2 {
|
||||
io.format("two!~n")
|
||||
}
|
||||
else {
|
||||
io.format("else~n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@public
|
||||
run = fn () {
|
||||
show_if_with_parenthesis(random.uniform(3))
|
||||
show_if_without_parenthesis(random.uniform(3))
|
||||
|
||||
show_switch_with_parenthesis(random.uniform(3))
|
||||
show_switch_without_parenthesis(random.uniform(3))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue