[Solved] Skip & Continue

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

[Solved] Skip & Continue

Post by J. Baker »

I would be nice to have a feature "Skip" that does what "Continue" does and then "Continue" sets you back into the loop. Well, as long as the loop isn't over. Quick and dirty example...

Code: Select all

; skip code 2 but jump back in for code 3

Repeat
  
  code 1
  
   Skip
  
    code 2
  
   Continue
  
  code 3
  
Until
Last edited by J. Baker on Wed Apr 18, 2012 4:12 am, edited 1 time in total.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Skip & Continue

Post by STARGÅTE »

thats the keyword IF:ENDIF

Code: Select all

; skip code 2 but jump back in for code 3

Repeat
  
  code 1
  
  If Not Skip
  
    code 2
  
  EndIf
  
  code 3
  
Until 
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Skip & Continue

Post by J. Baker »

Never thought of "If Not", thanks!

Code: Select all

a = 1
b = 2
c = 3

Debug a

If Not c = 3
  
  Debug b
  
EndIf

Debug c
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
Post Reply