Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Using Goto Label to mark part of codes

Author
Message
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 13th Feb 2018 03:28
Hi all,

As my codes grows, i started to use goto label, just the label to go to specific part of my code instead of scroll up and down. Will this have any impact later on? Thanks
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 13th Feb 2018 07:10 Edited at: 13th Feb 2018 07:11
A label on it's own doesn't generic any code, so No. Goto LABEL will of course generate a jump opcode (from this location in the code to some other location in the code) which is equally sublime .. Goto only causes people issues when they nest calls and the 'order' of code execution can get lost to the coder.

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
hoyoyo80
8
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 13th Feb 2018 07:32
Thanks for the reply..appreciate it. I do read about goto and gosub. I rewrite my code that have gosub(for restarting game) ...
Carharttguy
8
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 13th Feb 2018 22:03
Ho ho.

I will give you the best advice ever: Do not use goto, gosub. Ever. Use functions, use remarks ti mark your code, split code to other files.
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 14th Feb 2018 10:13
You try using foldstart to fold the code in the ide.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Feb 2018 13:19
I'd also advise not using GOTO, but I have no issue with GOSUB as it can help organize large chunks of code. Functions will make your code neat and more modular, but sometimes it's just not always a simple task. Good coding practices though will make it easier to build around functions instead.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 14th Feb 2018 13:38
Not 100% on topic but I wish the IDE would remember what code was folded when you start a project back up.
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 14th Feb 2018 18:00
Quote: "Not 100% on topic but I wish the IDE would remember what code was folded when you start a project back up."


1000% agree.

Login to post a reply

Server time is: 2024-11-21 19:21:28
Your offset time is: 2024-11-21 19:21:28