A Session Variable is merely a container that holds a value for the duration of a session. This value can be singular or it can be in the form of an Array.
If you want to assign a single value to the Session Variable, then just assign the value as in
179.99
If you want the Session Variable to be an Array, then your value must be an array as in
["179.99","9.99"]
If you want the Session Variable to hold a Keyed Array, then the value will look like
[{"product":"Los Angeles","qty":"1","price":"179.99"},{"product":"Cotton T-Shirt","qty":"1","price":"9.99"}]
The above examples show static values and in the case of a simple value, you can assign a dynamic value like
{{price}}
If you want to assign an Array to the Session, then you could have something like
[{{price[0]}},{{price[1]}}]
(not sure if this will work, so treat this as theoretical)
The problem with this is that every time there is an modification to the array, you must code to facilitate this. Wappler makes it very easy to handle Arrays (I will not elaborate on this here), including Keyed Arrays.
So to answer your query, unless you want to code the whole thing yourself, it is best to use Wapplerâs Arrays to populate the Session Variable.