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
hoc syntax - { }
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: hoc syntax - { }
There is a conventional distinction between a scripting language and a programminglickfett wrote:I'm working on a hoc script
language in the sense that the former is incomplete in some regard. hoc is a
programming language.
There are circumstances in which [ ] makes a difference, but people oftenlickfett 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
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.