Author Topic: Practical Difference Between Using GOSUB/GOTO / label / END SUB vs EXIT SUB?  (Read 6821 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
That's not quite it, x should come out either 2 if came in 2, changing y to 10, or come out 4 leaving y unchanged, but you proved my point, thankyou!  ;-))

Good luck with the real work for the day!

oh you gave no stipulations like that,
Code: QB64: [Select]
  1.   SUB dosomething
  2.      IF x = 2 THEN y = 10
  3.      IF x <> 2  THEN  x = 4
  4.   END SUB
  5.  

there still no GOTO, EXIT, or ELSE.

Granted after becoming radioactive I only have a half-life!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
oh you gave no stipulations like that,
Code: QB64: [Select]
  1.   SUB dosomething
  2.      IF x = 2 THEN y = 10
  3.      IF x <> 2  THEN  x = 4
  4.   END SUB
  5.  

there still no GOTO, EXIT, or ELSE.

Nice, I wish I'd thought of that, so simple.

Sure, let's waste more time with this silly thing! ;-))

I didn't think stipulations were needed as implied from original post but I missed part of just deciding only between

EITHER GOTO (not GOSUB at least the way presented)

OR EXIT SUB

EITHER/OR games are usually traps lawyers use! ;-))

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
and more time wasted...

Seems to me OP maybe working with code that is from pre ELSE existence because the situation setup as he presented simply begs for ELSE no matter how complex the code he is boiling it down from, it has a simple ELSE sol'n.

He has practically defined when to use ELSE.

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
and more time wasted...

Well, we are nerdy programmers what else are we to do?!  Not like we have a life!

This was fun but I don't think I will be mentioning it in the podcast NEWS segment.
Granted after becoming radioactive I only have a half-life!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
LOL It is nerdy, ha!