doc: add match statement to sample file
This commit is contained in:
@@ -6,13 +6,15 @@ x = ((1 + 2 * 3) multiplyBy:3).
|
||||
p = 5 multiply(by:3 add:(2 + 1)).
|
||||
q = 10 squared squared.
|
||||
|
||||
|
||||
|
||||
p1
|
||||
setAge:2 squared squared + 4 squared multiply(by:2 add:4 + 1 * 3)
|
||||
in:"mon" + "ths".
|
||||
|
||||
M = xz multiply(by:3 add:2) squared.
|
||||
|
||||
M = xz multiplyBy:3 add:2; yourself.
|
||||
M = xz multiply(by:3 add:2); squared.
|
||||
|
||||
x = OrderedCollection new
|
||||
add: 2;
|
||||
@@ -24,10 +26,25 @@ x = OrderedCollection new
|
||||
age = Person new(name:"John Doe" age:34)
|
||||
setAge:144 inUnit:"months";
|
||||
ageInMonths.
|
||||
|
||||
|
||||
|
||||
x = 5.
|
||||
q = 10 if x > 2.
|
||||
q = if x > 2 then 10 else 20 end.
|
||||
|
||||
cout put:5 multiply(by:5 add:2) if x > 2.
|
||||
|
||||
if x > 2 then
|
||||
cout put:"Greater"
|
||||
else
|
||||
cout put:"Less"
|
||||
end
|
||||
*/
|
||||
|
||||
--x = 5.
|
||||
--q = 10 if x > 2.
|
||||
--q = if x > 2 then 10 else 20 end.
|
||||
|
||||
cout put:5 multiply(by:5 add:2) if x > 2.
|
||||
Q = match yz in
|
||||
1 => age = age,
|
||||
2 => age = age / 12,
|
||||
3 => age = age / 365,
|
||||
_ => age = 0
|
||||
end.
|
||||
Reference in New Issue
Block a user