Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 02:33 02 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : EXIT or END SUB

Author Message
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 09:53am 05 Oct 2015
Copy link to clipboard 
Print this post

If I have a subroutine and I want to exit early, does it matter if I use end sub or exit sub to do so?

SUB STUFF
IF A = 0 THEN
A = A + 1
B = C * 8
END SUB <<<<< THIS LINE
END IF
C = 3
PIN(6) = 1
END SUB

THANKS!
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 10:05am 05 Oct 2015
Copy link to clipboard 
Print this post

from the manual

[quote] END SUB
Marks the end of a user defined subroutine. See the SUB command.

Each sub must have one and only one matching END SUB statement. Use EXIT SUB if you need to return from a subroutine from within its body.
[/quote]
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 09:29am 06 Oct 2015
Copy link to clipboard 
Print this post

There goes that "RTFM" alarm again. Thanks Bob!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024