Page 1 of 1

Posted: Fri Jun 07, 2002 1:20 pm
by BackupUser
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?

Posted: Fri Jun 07, 2002 3:43 pm
by BackupUser
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):

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

Posted: Fri Jun 07, 2002 6:33 pm
by BackupUser
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.