Language
Version: 2.2.0
Categories
-
User Program Communication
-
Variables
-
Control Flow
-
Functions and Blocks
-
Object Oriented Programming
Variables
Constants in Ruby
Used to declare a variable whose value is not meant to be changed.
Syntax
#constant name must start with a capital letter
CONSTANT_NAME = value
Notes
There are no true constants in Ruby. Variables declared as constants can be modified after assignment, but a warning is given by the compiler.
Example
PI = 3.14