Author Topic: Why never to use Goto.  (Read 23951 times)

0 Members and 1 Guest are viewing this topic.

Offline MRide

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 711
  • Rating: +14/-0
  • You can't see this.
    • View Profile
Why never to use Goto.
« on: August 09, 2010, 07:48:58 pm »
Why never to use goto.


Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Why never to use Goto.
« Reply #1 on: August 09, 2010, 08:01:33 pm »
LOL :) That was a good one!  Some of my earlier programs use a ton a "gotos".  I should be careful to watch out if I will be eaten. :)


Offline qazz42

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1130
  • Rating: +30/-12
  • hiiiiiiiii
    • View Profile
Re: Why never to use Goto.
« Reply #2 on: August 09, 2010, 08:04:38 pm »
Man, that happened to me all the time back then, thank god I taste bad

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Why never to use Goto.
« Reply #3 on: August 09, 2010, 08:05:00 pm »
lol!
When I was a total noob, I used gotos before I learned about while and repeat.

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Why never to use Goto.
« Reply #4 on: August 09, 2010, 08:06:37 pm »
goto has its legitimate uses, though, such as escaping from multiple nested loops in a simple fashion.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Why never to use Goto.
« Reply #5 on: August 09, 2010, 08:31:01 pm »
I love Java's break statement. It changed my life. Before, I would just goto out of the loop.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Why never to use Goto.
« Reply #6 on: August 09, 2010, 09:26:02 pm »
goto has its legitimate uses, though, such as escaping from multiple nested loops in a simple fashion.

Its useful except when it creates memory leaks :P In TiBasic it can have good uses though, i use it a lot in Serenity a lot in the form of massive switch statements, i find its a lot faster then having a ton of If:Then blocks.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Why never to use Goto.
« Reply #7 on: August 09, 2010, 10:17:33 pm »
Lolz, I remember that comic!

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Why never to use Goto.
« Reply #8 on: August 09, 2010, 10:33:11 pm »
i think he went a little to far back.
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Why never to use Goto.
« Reply #9 on: August 09, 2010, 10:36:07 pm »
In Axe Gotos won't cause leaks fortunately. For massive BASIC programs (and even Axe), it gets hard to follow after a while, though. Also when using them in TI-BASIC, you have higher risks of accidentally causing memory leaks in your programs. I personally stopped using them after I finished The Reign Of Legends 3, in June 2004, with the exception of Illusiat TI-81 Remake, since the 81 has no While/Repeat/For() instruction. I have yet to use them in Axe.

Sadly, those memory leaks were not documented very well back in the days and tutorials on which it was were hard to find, so if you play stuff like Illusiat 11 or 12 or even ROL2, I suggest that you save often, else you can end up with ERR:MEMORY. Just to say how badly documented it was back then, FFTOM series have the game quit completly and tell the user to press ENTER to resume gameplay after exiting menus, before/after battles or even in the middle of battles.
« Last Edit: August 09, 2010, 10:38:43 pm by DJ Omnimaga »

SirCmpwn

  • Guest
Re: Why never to use Goto.
« Reply #10 on: August 09, 2010, 10:38:36 pm »
You can use Goto \ End \ End to unleak the memory.  Just have as many Ends as you have loops or Ifs.

Offline MRide

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 711
  • Rating: +14/-0
  • You can't see this.
    • View Profile
Re: Why never to use Goto.
« Reply #11 on: August 09, 2010, 10:39:47 pm »
I haven't use a Goto in BASIC since I was newb and made a game entirely out of menus.  I have used it a little bit in Axe, though.

SirCmpwn

  • Guest
Re: Why never to use Goto.
« Reply #12 on: August 09, 2010, 10:41:15 pm »
I use Goto all the time.  It's pretty useful if you know what you are doing.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: Why never to use Goto.
« Reply #13 on: August 09, 2010, 10:44:18 pm »
i use it when i am too lazy to rip apart the code and move something.   ie. interrupts.
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Why never to use Goto.
« Reply #14 on: August 09, 2010, 10:45:11 pm »
Well one other issue I got with Goto is when you have an extremly large program and a Lbl is located at the complete bottom of the program, it seems to take quite a while to load. If you use them you really need to use them at the right places and properly