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 to put the whole procedure into a single comment, I don’t want to have to put # before each line.
Is there any possibility to comment multiple lines in Tcl, as there is in Java using /* .. */?
I also want some of the text will be put into a 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:
and
I tend to prefer the
procbecause 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
procis as cheap assetandif {0} ...