hoc syntax - { }

Anything that doesn't fit elsewhere.
Post Reply
lickfett

hoc syntax - { }

Post 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
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: hoc syntax - { }

Post 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.
Post Reply