08-17-2023, 04:54 PM
(08-15-2023, 06:38 PM)dbox Wrote: The more I think about it the more inclined I am to change the way this is working in the next release of QBJS to increase compatibility with QB64. I think instead of extending the array to also support associative arrays (dictionaries), I'll pull this functionality out into a new type called Dictionary. Then I can implicitly convert any index values passed to an array to an integer, just as in QB64.Actually, I take that back... So as not to introduce a new keyword that could have other backwards compatibility challenges, I think I will just continue to use the array syntax. However, if no sizing is specified (e.g. dim lookup() As String) then I will assume it is an associative array (dictionary). Otherwise, we'll assume it is a normal QBasic style array and implicitly convert the index values to integers. This should make it more compatible in the future with examples like @bplus shared.
Here is what it looks like if you want to create a dictionary: