Modify ↓
#1812 closed Bug (No Bug)
AutoItSetOption("MustDeclareVars",1) not working fully
| Reported by: | Rackbrane | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | Cc: |
Description
Despite the MustDeclareVars option being set to 1, an undeclared variable is allowed when used as a For loop index.
AutoItSetOption("MustDeclareVars",1)
For $Undeclared = 1 to 2
Send("Echo " & $Undeclared & @CRLF)
Next
Attachments (0)
Change History (3)
comment:2 by , on Nov 15, 2010 at 12:30:16 AM
Thanks for your speedy response and apologies for my erroneous report.
comment:3 by , on Nov 15, 2010 at 10:45:47 AM
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

According to the help file for a For...Next loop:
'The Variable will be created automatically with a LOCAL scope, even when MustDeclareVars is on.
'
So, it's not a bug, it's a documented feature.