Re: Io chokes on sample code
Duke Normandin <[email protected]> Sun, 26 Feb 2012 05:51:52 -0700
| Newsgroups | gmane.comp.lang.io |
|---|---|
| Message-ID | <20120226055152.20609e01@select-man> |
On Sun, 26 Feb 2012 02:31:18 -0500 gatesphere <[email protected]> wrote: > That code would work perfectly in a script. However, in the > REPL, you need to put semicolons between statements sometimes. > Within parentheses is one of those times. So, corrected code in > the REPL is as follows: > > Io> Account := Object clone do( > ... balance := 0.0; > ... deposit := method(v, balance = balance + v); > ... withdraw := method(v, balance = balance - v); > ... show := method(writeln("Account balance: $", balance)) > ... ) > Thanks, Jake!! So the "rule-of-thumb" is to *always* use semicolons between statements while in the REPL? I'll have to check the docs as well ... -- Duke