[Wish:] Wish to support a[2]:=(x?) Topic is solved

Discuss the future of the AutoHotkey language
User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

[Wish:] Wish to support a[2]:=(x?)

Post by V2User » 14 Aug 2023, 15:10

Code: Select all

a:=[1,5,2,3]
a[2]:=(x?)
c:=a[2]
OutputDebug(IsSet(c))
image.png
image.png (33.35 KiB) Viewed 1100 times
Currently, it will throw an error. But it might be better, if array assignment could act as property assignment.

lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: [Wish:] Wish to support a[2]:=(x?)  Topic is solved

Post by lexikos » 14 Aug 2023, 19:45

The new documentation already says "Unsetting a variable or array element removes its value", but I haven't actually updated the behaviour for assignments yet.

However,

Code: Select all

c:=a[2]
OutputDebug(IsSet(c))
IsSet can't be called in this code if a[2] is unset, because you did not use ?.

Post Reply

Return to “AutoHotkey Development”