Ruby Programming/Reference/Predefined Variables

< Ruby Programming < Reference

Ruby's predefined (built-in) variables affect the behavior of the entire program, so their use in libraries isn't recommended.

The values in most predefined variables can be accessed by alternative means.

$!


$@


$/


$\


$,


$;


$.


$<


$>


$0


$$


$?


$:


$DEBUG


$defout


$F


$FILENAME


$LOAD_PATH


$SAFE

    0   No checks are performed on externally supplied (tainted) data. (default)

    1   Potentially dangerous operations using tainted data are forbidden.

    2   Potentially dangerous operations on processes and files are forbidden.

    3   All newly created objects are considered tainted.

    4   Modification of global data is forbidden.

$stdin


$stdout


$stderr


$VERBOSE


$- x


The following are local variables:

$_


$~


The following variables hold values that change in accordance with the current value of $~ and can't receive assignment:

$ n ($1, $2, $3...)


$&


$`


$'


$+


This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.