Hello, world
Hello World programs
Transcript show: 'hello world'
(StringMorph contents: 'hello world') openInHand
b := SimpleButtonMorph new.
b color: Color red. b label: 'Click Me'. b position: Display center.
b addMouseUpActionWith: 'self label: ''Hello World! Click me again!''. self addMouseUpActionWith: ''self delete'''.
b openInWorld.
SoundPlayer stopReverb
Speaker manWithHead say: 'hello world'
Speaker woman say: 'hello world'
Write 'hello world' anywhere, then ALT-i (Windows). An Inspector pops up.
OSProcess thisOSProcess stdOut nextPutAll: 'Hello World'
Workspace new textContents: ('Hello World!!
This is a test.
') withSqueakLineEndings; openLabel: 'Workspace test'
(StringHolder new textContents: (HtmlParser parse: 'hello World!') formattedText) openLabel: 'HTML output'.
Write a helloWorld.txt file to a remote computer by using ftp
s := ServerDirectory new.
s type: #ftp.
s server: 'myServerId'.
s user: 'myUserName'.
s password: 'myPassWord'.
s directory: '/theFullPathOfMyHomeDirectory'.
s openFTP.
stream:=s fileNamed: 'helloWorld.txt'.
stream nextPutAll: 'hello world!'.
stream close.
s quit.
A variant which makes intensive use of TextMorphs and shows How to lay out submorphs:
r := PasteUpMorph new.
r color: Color blue twiceLighter twiceLighter twiceLighter.
r position: 10@10.
r extent: 170@100.
r openInWorld.
r layoutPolicy: TableLayout new. "lay out contents as a table"
r listDirection: #leftToRight. "how we want to place the contents"
r listCentering: #topLeft. "start list at the top"
r wrapDirection: #topToBottom.
r wrapCentering: #topLeft.
"r changeDragAndDrop."
'Hello world! How are you doing?' do: [ :ch |
charTM := TextMorph new.
charTM beAllFont: ((TextStyle default fontOfSize: 36) emphasized: 1).
charTM contentsAsIs: ch asString.
charTM color: Color random.
r addMorphBack: charTM].
Scamper openOnUrl: 'http://www2.latech.edu/~acm/HelloWorld.shtml' asUrl
Or just paint 'Hello world' and publish it as a project on some server