Category:Smalltalk: Difference between revisions

Content added Content deleted
Line 426: Line 426:
foo := bar "assignment; let foo refer to the object to which bar refers to
foo := bar "assignment; let foo refer to the object to which bar refers to
(at that particular point in time)"
(at that particular point in time)"

foo := bar := 0. "assignment has a value"


^ a + 1 "return; the value of 'a+1' as the value of the current method invocation."
^ a + 1 "return; the value of 'a+1' as the value of the current method invocation."


'hello' print. 'world' print "statements are separated by a period; just like in english"
'hello' print. 'world' print "expressions are separated by a period; just like in english"


|a b c| "local variables; introduces 'a', 'b' and 'c' in the current scope
|a b c| "local variables; introduces 'a', 'b' and 'c' in the current scope