Version 4 of if 0 {

Updated 2003-03-17 14:02:55

SB: Somebody care to explain why this search give so many hits?

http://mini.net/tcl/2?if+0+{*

NEM - It's used a lot in pages which are mostly code. By surrounding the non-code explanation parts in

if 0 {

This is some explanation

}

Then the whole page can be copied and pasted into a tclsh/wish/tkcon without the explanation bits causing an error. It's just a way of doing block commenting.

escargo 16 Mar 2003 - Isn't part of the point of this construct that no bytecodes get generated for any of the text included inside the curly braces? This removes any runtime penalty for including useful info (however structured) inside those braces?

NEM Yes, that's true. I imagine normal Tcl comments produce no bytecode too, though. The runtime efficiency of comments is generally not something to worry about unless you need serious performance, in which case you should probably be thinking about moving to C or some other language for that task.