Please send questions to
st10@humboldt.edu .
3+2 5
10+7 17
5 - 8 -3
5*8 40
5/8 (5/8)
5 @ 8 5@8
(5@8)class Point
5 < 8 true
(5<8)class True
(True)class
bool1 := true "not a message expression" true
bool2 := false "not a message expression" false
bool1 & bool2 false
bool1 | bool2 true
'Hel','lo' 'Hello'
today := Date today
today
tomorrow := today next 15 April 2011
tomorrow 15 April 2011
today < tomorrow true
"hello make sure this is a comment" nil
"note that := is not a binary message... "
" (it is assignment)"
b1 := [:name| (SampledSound soundNamed: name) play].
b1 value: #croak.
3+2*5 25
"precedence among unary message is left-to-right,
precedence among binary messages is left-to-right,
and precedence among n-ary messages is left-to-right
unary messages are highest precedence,
binary messages are next,
and n-ary messages are next,
among n-ary messages, the longest message has precedence
where longest means the message with the highest n"
" so above -- + is sent to object 3 with 2 as a parameter, and
and object 5 results; * is sent to that object 5 with 5 as a parameter,
and 25 results"
3+(2*5) 13 "() can be used to indicate which message should be sent
first"
"for a binary message that isn't an operator is followed by :"
30 + 9 gcd: 26 13
2 raisedTo: 10 1024
"don't put the colon for a non-operator unary message"
26 negated -26
'squeak' reversed 'kaeuqs'
'squeak' length
Color r: 0 g: 1 b: 0 Color green
(1 < 2) ifFalse: [4] nil
(1 < 2) ifTrue: [4] 4
(1<2) ifTrue: [1+4] ifFalse: [100+5] 5
'squeak' size 6
b1 value: #chirp