Syntax of multiple variable assignments

Discuss any general programming issues here
Post Reply
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Syntax of multiple variable assignments

Post by Flinx »

I just made a mistake because I had not yet fully grasped the syntax of multiple variable assignments. I had

Code: Select all

Local a, b
and added an assignment

Code: Select all

Local a, b=1
and overlooked the fact that the 1 is then assigned to a.
Perhaps a warning would help if fewer values are assigned than variables are listed.

Ralf
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Syntax of multiple variable assignments

Post by airsoftsoftwair »

Flinx wrote: Thu Sep 15, 2022 11:06 am Perhaps a warning would help if fewer values are assigned than variables are listed.
That wouldn't make sense because variables are often declared without being initialized so this would trigger a lot of false positive warnings.
Post Reply