Jump to content

Recommended Posts

Posted

following snipet

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc

$var = exit2()

it doesnt error while i did not declare $var, bug ?

dim $var = exit2()

gives an "Error in expression", bug ?

or is this intended. ifso how can i avoid this ?

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Posted (edited)

Odd. ;)

I just tried the following with both the beta and the production version and got an error both times.

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
$Var=Exit2()

The error was as follows:

C:\Documents and Settings\Michael\Desktop\d.au3 (5) : ==> Variable used without being declared.:

$Var=Exit2()

^ ERROR

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Posted (edited)

Odd. ;)

I just tried the following with both the beta and the production version and got an error both times.

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
$Var=Exit2()

The error was as follows:

thats what its supposed to do.

try this:

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
Dim $Var=Exit2()

that should not error out.

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Posted

I have not seen "MustDeclareVars" preprocess declarations so since the script exits before $var is filled with a value then should AutoIt error? If you replace Exit with Return 1 then you get the declaration error or if you use Dim it works fine.

Posted

It doesn't error in production version, only beta. I understand why it is a bug, but is a ret value expected when you send the exit keyword? No OnAutoItExit func is defined...

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Posted

No, a return value isn't expected even if an OnAutoItExit() function is defined because control will not (or at least should not) return to the caller of the function in either case.

Posted (edited)

It doesn't error in production version

I get an error in the production version on my pc as my post says above.

I am using the latest production version. (3.1.1.0)

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Posted

using the following code, it only has an 'error in expression' for the beta, not the prod

Opt("MustDeclareVars", 1)
func exit2()
    Exit
EndFunc
Dim $Var=Exit2()

If you remove Dim and run the beta version, it does not error out, most likely because it processes exit2() before sending the return value to a variable, as I would expect.

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())

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
×
×
  • Create New...