PDA

View Full Version : easy array define for 2-column array?



HankFay
2014-02-08, 20:23
In Lianja, an easy way to declare a 1-column array is:


la = ("Hank","Barry","David")

Is there a comparable way to define a 2-column array?

thanks,

Hank

barrymavin
2014-02-08, 21:25
Hi Hank,

You use {..} not (..) (typo?)

See attached screenshot:

504

Alternatively if you know JSON you can create objects and arrays with members that are objects and arrays like this:

505

HankFay
2014-02-08, 21:32
Ah, I see. Thanks!

And I used the plain parens, and it did work: good for you! <s> But, for 2-column, squiggly-brackets are required, per your example.

Hank

barrymavin
2014-02-08, 21:54
Actually ( .. ) doesn't work the same as { .. }.

In Lianja you can initialize all elements in an array like this.



dimension la(5)
la = 0


If you assign an bracketed expression to the array it is just initialized to that value.

You need to use {..}.

HankFay
2014-02-08, 22:24
Hmph! That's what I get for not checking it again: you're right of course, plain parens don't work. I swear it did that once <s>.