Ruby provides a number of ways to get input from the user. we will use gets in this example. The gets method is basically the opposite of puts — instead of printing stuff, it gathers what the user types for you. puts "Welcome to Shapes"
After print statement, collect the user’s input into a variable (shape_size):
print "How big do you want your shape? "
print "How big do you want your shape? "
shape_size = gets
What are some of your favorite gems? What are their alternatives?
Ruby program to Calculate the factorial of given number
How to create two dimensional array in ruby?
How to Replace array elements in Ruby?
What are the various Ruby runtimes, and how are they different?
Program to Print Triangle of Numbers in Ruby
How to get index of array element in Ruby
how to create an array with Array.[](*args) in Ruby ?
What are #method_missing and #send? Why are they useful?
What's the difference between a lambda, a block and a proc?
Ruby program to add two integer numbers
Ruby program to generate random numbers
How to Get Input with Gets in Ruby
Creating Array with Array.new(size, obj) in Ruby
Ruby program to check whether the given number is prime or not
Ruby program to print an array
Ruby program to check whether the given number is palindrome
How to Sort Array in Ruby?
How to add/remove elements to Array in Ruby?
Ruby program to check whether the given number is Armstrong
Ruby program to print Fibonacci series
Ruby program to reverse a string
How to shuffle an array in Ruby?