Ruby Arrays
es404020
Posted on September 6, 2021
Array is a container made up of rows and col .In which every row and col denote a unique position in the container .Take for instance a prison .Each cell(col) in a prison belong to a block (row) which can be uniquely identified.
In ruby array are denote as
a = [1,3,4,6,7,8]
Ruby also have a lot of function to manipulate an array .To make this blog interesting let make it a quiz.
Quiz
a.length-
a.last
a.first
a.select {|number| number.odd?}
a.joint("-")
a.split(" ")
%w{"my name is eniola ajani solomon")
Array loop
each
a.each do |value|
puts value
end
for
for i in a
puts i
end
```
`
To get more array method
```
a.methods
```
Thanks for reading
š šŖ š
š©
es404020
Posted on September 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.