What's the best way to create a 3-dimensional array?

Hi guys,
I’m new to ruby and flowstone and I want to know what’s the best methods
for creating a 3-dimensional array, I’ve seen some different methods
online and thought I’d better get your input on that.

The array dimensions are: 25, 3, 5 (not that it matter so much :slight_smile: )

thx i advance for the help.

Zb BZ wrote in post #1158263:

Hi guys,
I’m new to ruby and flowstone and I want to know what’s the best methods
for creating a 3-dimensional array, I’ve seen some different methods
online and thought I’d better get your input on that.

The array dimensions are: 25, 3, 5 (not that it matter so much :slight_smile: )

thx i advance for the help.

def new_array(*dims)
return 0 if dims.size==0
head,*tail=dims
(0…(head-1)).map { new_array(*tail) }
end

p mat=new_array(2)
p mat=new_array(2,2)
p mat=new_array(25,3,5)