|
|
//C++ style comments can be used
#as can shell-style comments
/* and C-stype comments */
"Hello world" print //hello world
for(i, 1, 10, i print) //prints numbers 1 through 10
x := Object clone //small-talk style object syntax, := used for new slots
x = Map clone //when overwriting, = is used.
x prettyprint := method( //make a method with no arguments
foreach(key, value, write(key, ": ", value, "\\n")) //loop through map
)
x atPut("hi", 1) //put key-value pair in map
x atPut("hello", 2)
x prettyprint /* output:
hi: 1
hello: 2
*/
Io was created in 2002 by Steve Dekorte and can be used under a BSD-style licence.