I have code here
proc checkPrime {no} {
set i 1
set count 0
while {$i < $no} {
if {{$no%$i} eq 0} {
incr count
}
if {$count eq 2} {
puts "the number is prime number"
return
}
incr i
}
}
i want put the whole procedure into a single comment, i don't want put each line with #, is there any possibility like in java /* .. */ with all code commented, like that in tcl. and i also want some of the text will be put single comment
Apart from the if {0} ..
which is idiomatic (and one that most tcl programmers recognize) you can also use any other construct and stuff the things you want commented out in brace quotes. The real mechanism preventing execution here is that things inside brace quotes don't get substituted.
Here are some of my favourites. I like them because they are self-documenting:
set COMMENTED_OUT {
commented out stuff
}
and
proc COMMENTED_OUT {} {
commented out stuff...
}
I tend to prefer the proc
because the block of commented out text is really a block of code.
Note that tcl does not compile proc bodies until first execution so commenting out using a proc
is as cheap as set
and if {0} ...