[Gambas-user] usage of too much GOTO can be bad pracitce or make influence in the code?

Christof Thalhofer chrisml at ...3340...
Sun Jun 25 11:31:33 CEST 2017


Am 22.06.2017 um 16:10 schrieb PICCORO McKAY Lenz:

> so i put
> 
> if not isnull()
>   goto codepiecelabel1
> endif
>   ' amount of lines
> 
> codepiecelabel1:
> ' here the 4000 lines
> 
> 
> i cannot use a sub procedures due manage some variables

I never understood the religious cruzification of Goto.

Sometimes I do things like:

If anyvar = Null then
   Goto EndAndExit
Endif

'Some or a lot of code ...
'Inside another break:

If anothervar = Null Then
   Goto EndAndExit
Endif


EndAndExit:
End

For that situations I find Goto very useful.

If I use Goto, I only use it to jump downwards. I for me found out that
jumping upwards is a jump to hell.

And if it is really useful (jumping upwards, very very seldom) then it
has to be heavily documented.


Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20170625/118a75f7/attachment.sig>


More information about the User mailing list