Scripting error using arrays

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
Daniel0312
Posts: 241
Joined: 15 Feb 2016 10:48

Scripting error using arrays

Post 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;
Daniel
XY32 latest stable / Windows11 23H2 / Scaling 100%

RalphM
Posts: 2116
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Scripting error using arrays

Post by RalphM »

If both lines are within the same script file, you should read up on indentation.
Ralph :)
(OS: W11 25H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: Scripting error using arrays

Post 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.

Daniel0312
Posts: 241
Joined: 15 Feb 2016 10:48

Re: Scripting error using arrays

Post by Daniel0312 »

@RalphM : I did :) sorry I dropped it when posting the code.

and indeed I should have posted the error message ! Thanks
Daniel
XY32 latest stable / Windows11 23H2 / Scaling 100%

admin
Site Admin
Posts: 66619
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Scripting error using arrays

Post by admin »

Indeed! :tup: Undetected for 1 month! :shock: Fix comes.

Daniel0312
Posts: 241
Joined: 15 Feb 2016 10:48

Re: Scripting error using arrays

Post by Daniel0312 »

Thanks Don, works fine in v23.60.0015 - 2022-09-14 17:50
Daniel
XY32 latest stable / Windows11 23H2 / Scaling 100%

Post Reply