Loading ...
Sorry, an error occurred while loading the content.

Exit while/wend

Expand Messages
  • Mike
    Hi all, Could anyone please confirm whether or not the following code is safe to use? Is it ok to exit a while/wend loop by detecting a button click with
    Message 1 of 1 , Sep 1, 2001
    • 0 Attachment
      Hi all,

      Could anyone please confirm whether or not the
      following code is safe to use? Is it ok to
      exit a while/wend loop by detecting a button
      click with 'scan' and then setting the
      control value n equal to 0? Or is this a stack
      error waiting to happen?

      Thanks,
      Mike.

      nomainwin
      button #w.b1, "Test", [test], UL,10,10,30,20
      statictext #w.st1, "",10,40,100,20
      statictext #w.st2, "",50,13,100,20
      open "test" for window as #w
      print #w, "trapclose [quit]"
      n=1
      print #w.st2, "n=";n

      [wwloop]
      while n=1
      now$=time$()
      print #w.st1, now$
      while now$=time$()
      wend
      scan
      wend
      wait

      [test]
      n=1-n
      print #w.st2, "n=";n
      print #w.st1, ""
      if n=1 then [wwloop]
      wait

      [quit]
      close #w
      end
    Your message has been successfully submitted and would be delivered to recipients shortly.