[Gambas-user] Writing a "Choose Your Own Adventure" prototype

Doriano Blengino doriano.blengino at ...1909...
Thu Apr 16 09:41:30 CEST 2009


jbskaggs ha scritto:
> I am not saying goto isnt needed at all-  just that to do what he is doing it
> isn't.  Furthermore too many goto's create spaghetti code which becomes
> really hard to follow. :)
>
>
> But I do get what your saying and I have used goto's the same way- though
> not in a while.  For me it was when I began to think less sequentially and
> more interconnectedly that my code became clearer and my need for goto's
> became less.  And it was hard for me to overcome my habit of:
>
> 10 input x
> 20 if x = 0 then goto 40
> 30 goto 10
> 40 print "yeah"
> and so on...
>
> I seriously had a hard time grasping that OO was pseudo nonsequential!
>   
I think that GOTOs have nothing to do with OO programming, but instead 
they relate to "structured programming".
In C and Pascal (and many many others), which are structured, you can 
totally avoid GOTOs, if you want. But, as Nando says, sometimes GOTOs 
are clearer that while-do-loop-if-elseif-elseif and so on.
The real thing is to have *both* structures and GOTOs; if either is 
missing, then the language is poor.

Regards,
Doriano




More information about the User mailing list