doc: update complex-msg syntax examples
This commit is contained in:
@@ -138,16 +138,10 @@ class Person
|
|||||||
-> exampleProperty4 (get)
|
-> exampleProperty4 (get)
|
||||||
end
|
end
|
||||||
|
|
||||||
p1 = Person new(name:'John Doe' age:34).
|
p1 = Person new(name:'John Doe', age:34).
|
||||||
p1 setAge:100 inUnit:$months.
|
p1 setAge:100 inUnit:$months.
|
||||||
|
|
||||||
|
p1 test(param:'Hello', 'World').
|
||||||
/**
|
|
||||||
when sending a message with unlabeled parameters, the preceding colon (:) is
|
|
||||||
still required. this is part of the reason why unlabeled parameters are
|
|
||||||
weird and not recommended.
|
|
||||||
**/
|
|
||||||
p1 test(param:'Hello' :'World').
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
@@ -388,10 +382,10 @@ cout put:'Hello, world!' if x > 10.
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
p1
|
p1
|
||||||
setAge:2 squared squared + 4 squared multiply(by:2 add:4 + 1 * 3)
|
setAge:2 squared squared + 4 squared multiply(by:2, add:4 + 1 * 3)
|
||||||
in:'mon' + 'ths'.
|
in:'mon' + 'ths'.
|
||||||
(p1
|
(p1
|
||||||
setAge:(((2 squared) squared) + ((4 squared) multiply(by:2 add:(4 + (1 * 3)))))
|
setAge:(((2 squared) squared) + ((4 squared) multiply(by:2, add:(4 + (1 * 3)))))
|
||||||
in:('mon' + 'ths')).
|
in:('mon' + 'ths')).
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@@ -445,7 +439,7 @@ pkg2 = pkg1 map:[ :x | ^x * 2 ].
|
|||||||
single recipient.
|
single recipient.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
age = Person new(name:'John Doe' age:34);
|
age = Person new(name:'John Doe', age:34);
|
||||||
setAge:144 inUnit:$months;
|
setAge:144 inUnit:$months;
|
||||||
ageInMonths.
|
ageInMonths.
|
||||||
|
|
||||||
@@ -453,7 +447,7 @@ age = Person new(name:'John Doe' age:34);
|
|||||||
-- the same behaviour can be achieved by using do..end
|
-- the same behaviour can be achieved by using do..end
|
||||||
|
|
||||||
age = do
|
age = do
|
||||||
x = Person new(name:'John Doe' age:34).
|
x = Person new(name:'John Doe', age:34).
|
||||||
x setAge:144 inUnit:$months.
|
x setAge:144 inUnit:$months.
|
||||||
x ageInMonths
|
x ageInMonths
|
||||||
end
|
end
|
||||||
@@ -476,7 +470,7 @@ end
|
|||||||
all objects by default and always returns the object itself::
|
all objects by default and always returns the object itself::
|
||||||
**/
|
**/
|
||||||
|
|
||||||
p1 = Person new(name:'John Doe' age:34);
|
p1 = Person new(name:'John Doe', age:34);
|
||||||
setAge:100 inUnit:$months;
|
setAge:100 inUnit:$months;
|
||||||
yourself::
|
yourself::
|
||||||
|
|
||||||
@@ -484,7 +478,7 @@ p1 = Person new(name:'John Doe' age:34);
|
|||||||
/* again, with do..end */
|
/* again, with do..end */
|
||||||
|
|
||||||
p1 = do
|
p1 = do
|
||||||
x = Person new(name:'John Doe' age:34).
|
x = Person new(name:'John Doe', age:34).
|
||||||
x setAge:100 inUnit:$months.
|
x setAge:100 inUnit:$months.
|
||||||
x
|
x
|
||||||
end.
|
end.
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
2 + 3 * 4.
|
var y = 32.
|
||||||
|
var f = [ :x | x * 2 + y ].
|
||||||
|
var result = f(4).
|
||||||
|
|||||||
Reference in New Issue
Block a user