Page 1 of 1
hoc syntax - { }
Posted: Tue Jun 14, 2005 5:20 pm
by lickfett
I'm working on a hoc script created by someone else and periodically there will be several statements enclosed by braces. Is this some special syntax in hoc, or are these extraneous?
In other words, is
{statement1
statement2}
equivalent to
statement1
statement2
regards,
Jay
Re: hoc syntax - { }
Posted: Wed Jun 15, 2005 6:50 pm
by ted
lickfett wrote:I'm working on a hoc script
There is a conventional distinction between a scripting language and a programming
language in the sense that the former is incomplete in some regard. hoc is a
programming language.
lickfett wrote:
created by someone else and periodically there will be several statements enclosed by braces. Is this some special syntax in hoc, or are these extraneous?
In other words, is
{statement1
statement2}
equivalent to
statement1
statement2
There are circumstances in which [ ] makes a difference, but people often
just stick them in as a half-hearted attempt to organize their code.
One place where [ ] does do something:
{ stmt1 stmt2 }
works, but
stmt1 stmt2
produces an error msg.
Example: { x=3 y=4 }
So are the { } in your program serving a useful purpose?
A way to find out is to remove a pair of them and see what happens.