Ruby doesn't have any class like two dimensional Array. Let's create Two dimensional array Syntax Array = [ [val1,val2], [val3,val4], ... ] Example # a two-dimensional array declaration arr = [[1,2],[2,3],['Sachin','India'],['Pointing','Australia']] # printing puts "The two dimensional Array elements are:" print arr Output Creating Two Dimensional Array with Array.new() method Syntax:
The combination of 1dimensional array will called TWo dimensional array.
The two dimensional Array elements are:
[[1, 2], [2, 3], ["Sachin", "India"], ["Pointing", "Australia"]]
array_name = Array.new(size, Array.new)
Ruby program to generate random numbers
What are #method_missing and #send? Why are they useful?
How to get index of array element in Ruby
How to Get Input with Gets in Ruby
What are some of your favorite gems? What are their alternatives?
How to shuffle an array in Ruby?
Ruby program to check whether the given number is prime or not
How to add/remove elements to Array in Ruby?
Ruby program to reverse a string
Ruby program to add two integer numbers
How to create two dimensional array in ruby?
How to Sort Array in Ruby?
What are the various Ruby runtimes, and how are they different?
how to create an array with Array.[](*args) in Ruby ?
What's the difference between a lambda, a block and a proc?
Creating Array with Array.new(size, obj) in Ruby
Ruby program to Calculate the factorial of given number
Ruby program to print an array
How to Replace array elements in Ruby?
Ruby program to print Fibonacci series
Program to Print Triangle of Numbers in Ruby
Ruby program to check whether the given number is Armstrong
Ruby program to check whether the given number is palindrome