eval.in

Paste #157

Io — Io 20110912, pasted 4 years ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Greeter := Object clone do(
  name := ""
  withName := method(name,
    self name := name
    self
  )
  greet := method(
    "Hello #{name}!\n" interpolate print
  )
)

Greeter clone withName("Charlie") greet

Program Output

Hello Charlie!

OK (0.076 sec real, 0.125 sec wall, 6 MB, 15 syscalls)

Fork