Ary6[1..2,0..-1]

At the following:
http://ruby.gfd-dennou.org/tutorial/gokuraku/index-e.html

Under “Index”, I want to ask about the following:

ary6 = NArray.sfloat(4,3).indgen!(1.02.0) # This line didn’t work

ary6[1…2,0…-1] # What is meant by this line? didn’t understand how
the output was formed

Thanks.

Hi,

On 03.09.2010 13:41, Abder-Rahman A. wrote:

At the following:
http://ruby.gfd-dennou.org/tutorial/gokuraku/index-e.html

Under “Index”, I want to ask about the following:

ary6 = NArray.sfloat(4,3).indgen!(1.02.0) # This line didn’t work

ary6[1…2,0…-1] # What is meant by this line? didn’t understand how
the output was formed

This is just another form of array slicing, see
http://ruby-doc.org/core/classes/Array.html#M002160 for the details.

HTH

Can you clatfiy my question based on this? Still cannot get the idea.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs