프로그래밍잔치/SmallTalk (rev. 1.1)
Hello World ¶
Object subclass: #HelloWorld
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'HelloWorld'
printHello
Transcript show: 'Hello World'.
hello := HelloWorld new.
hello printHello.
구구단 ¶
~cpp
Object subclass: #GuGuDan
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'GuGuDan
~cpp
printGuGu
2 to: 9 do:
[
:i | Transcript cr; show: i asString, 'dan'.
1 to: 9 do:
[
:j | Transcript cr; show: i asString, ' * ', j asString, ' = ', (i*j) asString.
].
].
~cpp
gugu := GuGuDan new.
gugu printGuGu.