Restored from previous forum. Originally posted by Justin.
Is there any command in PB similar to break to exit a loop or continue to re-evaluate?
Break / Continue?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> Is there any command in PB similar to break to exit a loop or continue to re-evaluate?
Not yet, but you can break out of a loop by manually forcing it, like in this
example (pseudo-code for testing only):
PB - Registered PureBasic Coder
> Is there any command in PB similar to break to exit a loop or continue to re-evaluate?
Not yet, but you can break out of a loop by manually forcing it, like in this
example (pseudo-code for testing only):
Code: Select all
; Input 1000 entries or until "exit" is entered.
For counter=1 To 1000
Input a$
If a$="exit"
counter=1000 ; This exits the loop.
EndIf
Next
PB - Registered PureBasic Coder
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Justin.
thanks but i was looking for a way to exit the loop without finishing it:
For counter=1 To 4
If counter=2
counter=4
MessageRequester("","Stop",0)
EndIf
MessageRequester(Str(counter),"Process",0) ;get rid of this process
Next
a standard 'break' to work with for/next and while/wend, anyway there are workarounds for that, just wanted to know if there was a function.
thanks but i was looking for a way to exit the loop without finishing it:
For counter=1 To 4
If counter=2
counter=4
MessageRequester("","Stop",0)
EndIf
MessageRequester(Str(counter),"Process",0) ;get rid of this process
Next
a standard 'break' to work with for/next and while/wend, anyway there are workarounds for that, just wanted to know if there was a function.