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)
How to Replace array elements in Ruby?
Ruby program to Calculate the factorial of given number
What are the various Ruby runtimes, and how are they different?
How to Get Input with Gets in Ruby
Creating Array with Array.new(size, obj) in Ruby
How to get index of array element in Ruby
How to create two dimensional array in ruby?
How to shuffle an array in Ruby?
Ruby program to check whether the given number is palindrome
Program to Print Triangle of Numbers in Ruby
Ruby program to print an array
What's the difference between a lambda, a block and a proc?
Ruby program to add two integer numbers
Ruby program to check whether the given number is prime or not
how to create an array with Array.[](*args) in Ruby ?
How to add/remove elements to Array in Ruby?
What are #method_missing and #send? Why are they useful?
Ruby program to check whether the given number is Armstrong
Ruby program to print Fibonacci series
Ruby program to generate random numbers
How to Sort Array in Ruby?
What are some of your favorite gems? What are their alternatives?
Ruby program to reverse a string