Jump to content

Do...until?


Guest USMarine
 Share

Recommended Posts

Guest USMarine

I have the following "random" error, minus the ::Error and ::EndOfError. This used to work, and now... it doesn't?

:D

The error is,

Until $NeverEnding = 2

"Until" statement with no matching "Do" statement.'

End of Error

Here is the code causing the error...

; Initialize Global variables

Global $RndJoke = 0

Global $PrevJoke = 100

Global $NeverEnding = 1

; Start the main script

Do

Do

$RndJoke = GenerateRndNumber()

Until $RndJoke <> $PrevJoke

$PrevJoke = $RndJoke

Call("Joke" & $RndJoke)

If $RndJoke = 0 Then

GenerateRndNumber()

EndIfPussy

Sleep(600000)

Until $NeverEnding = 2

Func GenerateRndNumber()

$RndJoke = Int(Random(6)+1)

Return $RndJoke

EndFunc

Link to comment
Share on other sites

  • Developers

here's your script processed with Tidy:

Notice the "EndIfPussy" statement

; Initialize Global variables
Global $RndJoke = 0
Global $PrevJoke = 100
Global $NeverEnding = 1

; Start the main script
Do
   Do
      $RndJoke = GenerateRndNumber()
   Until $RndJoke <> $PrevJoke
   $PrevJoke = $RndJoke
   Call("Joke" & $RndJoke)
   If $RndJoke = 0 Then
      GenerateRndNumber()
      EndIfPussy
      Sleep(600000)
;### Tidy Error: Level error -> Until is closing previous If
   Until $NeverEnding = 2
   
;### Tidy Error: Level error -> Func cannot be inside any IF/Do/While/For/Case/Func statement.
   Func GenerateRndNumber()
      $RndJoke = Int(Random(6) + 1)
      Return $RndJoke
   EndFunc  ;==>GenerateRndNumber
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest USMarine

Yeah, I see that now, thanks. HAHA, guess my friends got away with another one at MY expense.

:D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...