Can't figure out how to declare a string array on multiple lines
Asked Answered
C

1

1

This code was causing errors at runtime but would compile.

Local $acceptable[] = ["Chrome",_
                        "Firefox",_
                        "IE"]

It works if I move it all on one line. However, I want to declare many elements. How do I correctly declare it over multiple lines?

Corticate answered 1/12, 2014 at 12:49 Comment(0)
H
2

As per Language Reference - Comments (emphasis added):

Although only one statement per line is allowed, a long statement can span multiple lines if an underscore "_" preceded by a blank is placed at the end of a "broken" line. String definition cannot be split in several lines, concatenation need to be used.

Example (space before each underscore):

#include <Array.au3>

Global Const $g_aAcceptable[] = ["Chrome", _
                                 "Firefox", _
                                 "IE"]

_ArrayDisplay($g_aAcceptable)
Huffish answered 1/12, 2014 at 17:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.