Ruby/Language Basics/Global Variables
Материал из Wiki.crossplatform.ru
(Различия между версиями)
Версия 17:10, 26 мая 2010
define global variables by putting a dollar sign ($) in front of the variable name
def basic_method puts $x end $x = 10 basic_method
Global Variables
Global variables are available globally to a program. Their scope is the whole program. Global Variables are prefixed by a dollar sign ($). $amount = "0.00"