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