Re: Io chokes on sample code

Duke Normandin <[email protected]> Sun, 26 Feb 2012 10:50:58 -0700
Newsgroups gmane.comp.lang.io
Message-ID <20120226105058.6fb10019@select-man>
On Sun, 26 Feb 2012 10:26:14 -0500
gatesphere <[email protected]> wrote:



> Not "always", but whenever you have some statements that you're 
> separating by newlines.  When you do that, throw a semicolon in
> there.

I've also discovered that multiple statements on one line need to
be separated by a semi-colon in the REPL, as in:

Number factorial := method(n := 1; for(i, 1, self, n = n * i); n)

I tried the above w/o them and got stung!

So, newlines in the REPL notwithstanding, it seems that it's
there's multiple statements - separate them with a semi-colon.

I've also discovered that the newlines *in a script* serve as
statement separators. However, again, if the statements are all on
one line, the semi-colons are required. I gotta learn the hard
way, it seems. lol ...
 
> As mentioned on the irc channel yesterday, the Io interpreter
> translates newlines into semicolons when it reads in scripts, but
> in the REPL you have to do that manually.
> 
> You'll get a feel for it eventually.  I almost never use
> semicolons now, but I used to sprinkle everything with them.

It takes some getting used to - but then again, what doesn't! I
wish that I was a faster keyboarder - I'd join in on IRC....

Thanks!
--
Duke