Page 1 of 1

Scripting error using arrays

Posted: 14 Sep 2022 15:44
by Daniel0312
Hi,
The first line (taken from the help file) works fine.
The second one generates an error when assigning the array element.

Code: Select all

$n = 4; $a[$n+4] = $n * 4; echo $a[$n+4];
$n = 4; $a[$n+4] = $n * 4; $temp = $a[$n+4]; echo $temp;

Re: Scripting error using arrays

Posted: 14 Sep 2022 15:55
by RalphM
If both lines are within the same script file, you should read up on indentation.

Re: Scripting error using arrays

Posted: 14 Sep 2022 15:58
by Filehero
RalphM wrote: 14 Sep 2022 15:55 If both lines are within the same script file, you should read up on indentation.
The interpreter complains '$temp = $a[$n+4]' is not a valid script command.

Re: Scripting error using arrays

Posted: 14 Sep 2022 16:20
by Daniel0312
@RalphM : I did :) sorry I dropped it when posting the code.

and indeed I should have posted the error message ! Thanks

Re: Scripting error using arrays

Posted: 14 Sep 2022 16:32
by admin
Indeed! :tup: Undetected for 1 month! :shock: Fix comes.

Re: Scripting error using arrays

Posted: 14 Sep 2022 18:18
by Daniel0312
Thanks Don, works fine in v23.60.0015 - 2022-09-14 17:50