Page 1 of 1

List Construction

Posted: 9 Nov 2022 20:30
by daveplummermd
I remember seeing somewhere an abbreviated method to construct a list of sequential integers.
I am looking for:

Code: Select all

List=[1,2,3,4,5]
to be achieved with a shortcut looking something like this

Code: Select all

List=[1..5]
But, I can not remember or find the proper syntax for that abbreviated method.

Re: List Construction

Posted: 10 Nov 2022 9:22
by Thomas Linder Puls
We do not have such a syntax. But you can use a list comprehension like this:

Code: Select all

List = [ I || I = std::fromTo(1, 5) ]

Re: List Construction

Posted: 10 Nov 2022 17:13
by daveplummermd
Thank you!