Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:59 02 Jul 2025 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 : Multi line ELSE IF

     Page 2 of 2    
Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2523
Posted: 10:53pm 30 Jun 2025
Copy link to clipboard 
Print this post

could be
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1127
Posted: 11:32pm 30 Jun 2025
Copy link to clipboard 
Print this post

EXIT is a quick way out of DO and FOR loops.
For i = 1 To SomeNumber
  Do Stuff
  If somthing is TRUE Then Exit For
  Do Other Stuff
Next i

"Next" with a variable is slower than without.
Visit Vegipete's *Mite Library for cool programs.
 
scruss
Regular Member

Joined: 20/09/2021
Location: Canada
Posts: 90
Posted: 02:33am 01 Jul 2025
Copy link to clipboard 
Print this post

  PhenixRising said  It has been a while and I'm not at my desk to verify but I seem to remember finding for-next loops to be faster than do-loops


While you can change the value of a counter variable, it's not the most obvious way of exiting the loop. EXIT FOR, however, is explicit.

ANSI/ECMA Standard BASIC doesn't allow you to change a loop variable. Not that many people ever paid much attention to that standard.
 
     Page 2 of 2    
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025