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