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 )
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 )
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)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.