Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The language is a dialect of Smalltalk, so looking for Smalltalk examples might be more productive. There are some useful examples at http://wiki.c2.com/?SmalltalkExamples, such as (double quotes are comments):

    " this sends a message to the transcript "

    Transcript show: 'hello world '.


    " compute 10 factorial and send the result to the Transcript "

    Transcript show: 10 factorial.


    " now, try this: "

    Transcript show: 100 factorial.


    " a loop (the timesRepeat-method evaluates its argument n-times)"

    10 timesRepeat: [
        Transcript show:'hello'.
        Transcript cr.
    ].


    " another loop "

    1 to: 10 do:[ :i |
        Transcript show:i.
        Transcript show:' '.
        Transcript show:i sqt.
        Transcript cr.
    ].


    " looping over a collection "

    #('a' 'b' 'c' ) do:[:each |
        Transcript show: each.
        Transcript cr.
    ].


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: