Predefined Constants

The following table lists all the Ruby’s Predefined Constants −

NOTE − TRUE, FALSE, and NIL are backward-compatible. It’s preferable to use true, false, and nil.

Sr.No.Constant Name & Description
1TRUESynonym for true.
2FALSESynonym for false.
3NILSynonym for nil.
4ARGFAn object providing access to virtual concatenation of files passed as command-line arguments or standard input if there are no command-line arguments. A synonym for &dollar;<.
5ARGVAn array containing the command-line arguments passed to the program. A synonym for &dollar;*.
6DATAAn input stream for reading the lines of code following the __END__ directive. Not defined if __END__ isn’t present in code.
7ENVA hash-like object containing the program’s environment variables. ENV can be handled as a hash.
8RUBY_PLATFORMA string indicating the platform of the Ruby interpreter.
9RUBY_RELEASE_DATEA string indicating the release date of the Ruby interpreter
10RUBY_VERSIONA string indicating the version of the Ruby interpreter.
11STDERRStandard error output stream. Default value of &dollar;stderr.
12STDINStandard input stream. Default value of &dollar;stdin.
13STDOUTStandard output stream. Default value of &dollar;stdout.
14TOPLEVEL_BINDINGA binding object at Ruby’s top level.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *