Hi,
Is there goto command in Tcl.
If it's not there can anyone show me a example how
to do one.
I was trying not to use goto commands but in my program I
have to jump back.
thank you
sudhir
sud...@pyramid.cs.unr.edu
There is no goto. (thanks be to John and God)
>
> If it's not there can anyone show me a example how
> to do one.
Use the proc, while, and if-the-else constructs.
In the late 60s early 70s (refereences anybody) N. Wirth amd others wrote
several papers and books on goto-less programming, you may find them useful
reading.
>
> I was trying not to use goto commands but in my program I
> have to jump back.
This can be avoided through the use of the above mentioned statements. I once
had teh pleasure of removing two of the three gotos in a Pascal compiler (in
Pascal of course). The third goto was scheduled to get removed but we ran out
of time to do it.
|> In the late 60s early 70s (refereences anybody) N. Wirth amd others wrote
|> several papers and books on goto-less programming, you may find them useful
|> reading.
The main result was the "Boehm - Jacopini" theorem, which proved
(constructively) that for any given program you can write an equivalent program
that only uses sequence, selection (IF) and iteration (WHILE). The reason why I
remember the name is that I was lucky enough to have Corrado Boehm as a
professor (and an extraordinary one at that) in one of my university courses.
--
Frank (Filologo Disneyano)
Francesco> The main result was the "Boehm - Jacopini" theorem, which
Francesco> proved (constructively) that for any given program you can
Francesco> write an equivalent program that only uses sequence,
Francesco> selection (IF) and iteration (WHILE).
The big question would be:
"Is that equivalent program less readable and maintainable than the
original".
Actually I don't have a strong philosophical objection to goto. I think
that goto's should be used very sparingly, but there are definitely
situations where programs are a lot clumsier without them. The reason
they're not in Tcl is that I haven't been able to figure out how to
implement them (the structure of Tcl and its interpreter make it hard
to skip backwards or forwards).