semicolon after braces 
Author Message
 semicolon after braces

Dear group

I am going step by step through
http://www.*-*-*.com/
till my book arrives.

in the second line in the example;
puts {Hello, World - In Braces}     # *Error* - there is no semicolon!
I tried it and it worked with no error, why the example comments then
indicate that it is an error implying it must end with a ``;''?
I am using the inferior-mode tcl under emacs and tcl8.4 under debian
testing.

thanks



Sat, 27 Sep 2008 07:31:48 GMT  
 semicolon after braces


Quote:
> Dear group

> I am going step by step through
> http://www.tcl.tk/man/tcl8.5/tutorial/Tcl1.html
> till my book arrives.

> in the second line in the example;
> puts {Hello, World - In Braces}     # *Error* - there is no semicolon!
> I tried it and it worked with no error, why the example comments then
> indicate that it is an error implying it must end with a ``;''?
> I am using the inferior-mode tcl under emacs and tcl8.4 under debian
> testing.

Joe,

Did you actually type in the line with the '# *Error* - ' part as well?

The idea of this example is to show that without the semi-colon the command
will return an error to the effect that there are an incorrect number of
arguments - ie it includes the entry *after* the '#' as part of the the
arguments to the command.  Placing a ';' immediately before the '#' makes
this part of the line a comment so the error no longer exists.

HTH

        Rob.



Sat, 27 Sep 2008 08:07:52 GMT  
 semicolon after braces

Quote:

> Dear group

> I am going step by step through
> http://www.tcl.tk/man/tcl8.5/tutorial/Tcl1.html
> till my book arrives.

> in the second line in the example;
> puts {Hello, World - In Braces}        # *Error* - there is no semicolon!
> I tried it and it worked with no error, why the example comments then
> indicate that it is an error implying it must end with a ``;''?

You must be doing something different than you describe. That line
should indeed give an error. I just tried it with tcl8.4 and
inferior-tcl mode and got the error as expected.

Are you absolutely certain you  typed it exactly as indicated?

--
Bryan Oakley
http://www.tclscripting.com



Sat, 27 Sep 2008 08:23:06 GMT  
 semicolon after braces

Quote:
> The idea of this example is to show that without the semi-colon the command
> will return an error to the effect that there are an incorrect number of
> arguments - ie it includes the entry *after* the '#' as part of the the
> arguments to the command.

To be pedantic, the "#" is also taken to be an argument to [puts] in the
"borken" example (ie. [puts] gets 7 nonsensical arguments, not 6).

- Adrian



Sat, 27 Sep 2008 16:41:24 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. To semicolon or not to semicolon

2. Brackets in brackets, braces in braces

3. Brackets in brackets, braces in braces

4. can I use semicolon in END?

5. Semicolon problem

6. Semicolons (mandatory or optional)...

7. Semicolon

8. Semicolon

9. George's semicolon bug discovery

10. commas or semicolons

11. Semicolons

12. Problem with program object setup string w/ embedded semicolons

 

 
Powered by phpBB® Forum Software