When using Try with an unassigned var, instead of Try capturing the error for handling in Catch, it throws an error.
Is this intended?
a112 - Try with unassigned var Topic is solved
a112 - Try with unassigned var
« AHK Portable Installer » | « CallTipsForAll » | « TheArkive AHK v1 Scripts » | « TheArkive AHK v2 Scrpts » | « TheArkive on GitHub »
Re: a112 - Try with unassigned var
Currently this is the expected behaviour,
Cheers.
You can turn the warning off, if you want to fix it later.a112 wrote:Enabled #Warn UseUnset by default - to be converted to a continuable error at some point.
Cheers.
Re: a112 - Try with unassigned var
Ok that makes sense. Thanks!
From the point of a "best practice", would it make more sense to use #Warn to disable it, or to ensure values are initialized, or i guess (in that case) use IsSet()?
If figure this answer could easily be subjective, but just wondering what you think.
From the point of a "best practice", would it make more sense to use #Warn to disable it, or to ensure values are initialized, or i guess (in that case) use IsSet()?
If figure this answer could easily be subjective, but just wondering what you think.
« AHK Portable Installer » | « CallTipsForAll » | « TheArkive AHK v1 Scripts » | « TheArkive AHK v2 Scrpts » | « TheArkive on GitHub »
Re: a112 - Try with unassigned var Topic is solved
I would recommend you initialise your variables. I would probably only use isset to
- detect when an optional paramter was omitted (f(p:=unset)),
- detect if an initialisation has failed. Eg in a catch or finally block.
- Perhaps also for static vars in some cases.
Who is online
Users browsing this forum: Danielsan73, Smile_ and 41 guests