define global variables by putting a dollar sign ($) in front of the variable name : Global Variables « Language Basics « Ruby






define global variables by putting a dollar sign ($) in front of the variable name


def basic_method
  puts $x
end

$x = 10
basic_method

 








Related examples in the same category

1.Global Variables