Variables

Local Variable Declaration in Ruby

Used to declare a variable outside of a class.


Syntax
#local variable
variableName = value

#for class variables, look at the class and instance variables topic

Notes

Variables in Ruby are dynamically typed, which means no type is assigned to the variable.

All variables in Ruby are objects, which means methods can be invoked from the variable. In fact, everything in Ruby is an object.


Example
name = "Anthony"

Add to Slack

< Write to File   |   Constants >

© 2019 SyntaxDB. All Rights Reserved.