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