¶
- SBPP 공기 겠 각 .
기 ¶
~cpp ClassName>>methodName.
- . , Smalltlak 게 .
- Debug .
- . , Smalltlak 게 .
~cpp UndifinedObject(Object)>>doesNotUnderstand:
~cpp a := 1. b := OrderedCollection new.
~cpp Money class>>amout: anAmount self new setAmount: anAmount.
~cpp TempTestCase>>initialize super initialize.
~cpp a := OrderdCollection new add: 10; add: 1; add; 9; yourself.
~cpp Color>>alpha ... ^1.0
기 ¶
from VisualWorks Lesson Browser 01 (Lesson: Language Basic)
- 과 .All Smalltalk expressions follow the form:
- anObject aMessage.
- )
~cpp "Code in Bold" "Comments in double-quotes" 3 squared. "Receiver object is small integer 3." "The message sent is #squared" 'abc' asUppercase. "Receiver object is string 'abc'." "The message sent is #asUppercase" 200 factorial. "Receiver object is small integer 200." "The message sent is #factorial"
¶
from VisualWorks Lesson Browser 01 (Lesson: Language Basic)
- Unary messages
- , .(the selector is a single Identifier, there are no arguments)
- )
~cpp 3 negated "selector is #negated" 'abcdefg' reverse "selector is #reverse"
- , .(the selector is a single Identifier, there are no arguments)
- Binary messages
- 기( , )고, .(the selector is one or two non-alphanumeric characters, followed by exactly one argument object)
- )
~cpp 3 + 5 "selector is #+" "argument is the Integer object 5" 'abc' , 'xyz' "selector is #, (comma character)" "argument is the String 'xyz'" 20 <= 20 "selector is #<=" "argument is the Integer object 20"
- 기( , )고, .(the selector is one or two non-alphanumeric characters, followed by exactly one argument object)
- Keyword messages
- (:) .(a keyword is an Identifier followed by colon ":" )
- 각 , .(the selector is one or more keywords, when called each keyword is followed by an argument object) -> 고
- )
~cpp 3 raisedTo: 17. "selector is #raisedTo:" "argument is 17" 3 between: 5 and: 10. "selector is #between:and:" "arguments are 5 and 10" Point x: 4 y: 200. "receiver is the object Point" "selector is #x:y" "arguments are 4 and 200"
- (:) .(a keyword is an Identifier followed by colon ":" )
Message ¶
from Smalltalk by Example
- . Evaluation is done left to right.
- 그 2 + 3 * 6 -> 30
- 그 2 + 3 * 6 -> 30
- Unary . messages have the highest precedence.
- Binary 그 . Binary message have the next precedence.
- Keyword .Keyword message have the lowest precedence.
- '()' 경 . You can alter precedence by using parenthses.
Smalltalk