Sign in to follow this  
Followers 0
Guest USMarine

Do...until?

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

:D

Share this post


Link to post
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
Sign in to follow this  
Followers 0