Introduction to Ruby
Learn about Ruby, an object-oriented scripting language you can use on its own or as part of the Ruby on Rails web framework.
StartKey Concepts
Review core concepts you need to learn to master this subject
Ruby Variables
Put and print command
Code comments in Ruby
Numeric data types in Ruby
Arithmetic operations in Ruby
Ruby Object Methods
Strings in Ruby
Boolean Data Types in Ruby
Ruby Variables
Ruby Variables
myVar = 48
In Ruby, a variable is a place to store values of almost any type including Integer, Boolean, String, Array, and Hashes.
Each variable has its own name which cannot begin with a capital letter or a number and we use the equal sign for assigning a value to that variable.
The variable declaration does not require that you mention a specific data type.
The following program declares myvar
variable and assigns the value 48
.