Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

프로그래밍잔치/SmallTalk

From ZeroWiki

Hello World

Object subclass: #HelloWorld
	instanceVariableNames: 
	classVariableNames: 
	poolDictionaries: 
	category: 'HelloWorld'

printHello
	Transcript show: 'Hello World'.

hello := HelloWorld new.
hello printHello.

구구단

Object subclass: #GuGuDan
	instanceVariableNames: 
	classVariableNames: 
	poolDictionaries: 
	category: 'GuGuDan

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.
		].
	].

gugu := GuGuDan new.
gugu printGuGu.