- Home
- Interview Questions
- Ruby and Rails
Define operator defines whether a passed expression is defined or not. If the expression is defined it returns the description string or null if the expression is not defined. If a variable is defined it gets initialized. If method_call is defined as true then method also gets defined. This is also the same case with super and yield.
Like all the modem languages Ruby supports many different operators to its credit. Most of the operators in Ruby are in fact methods due to the object oriented nature of the language. This feature gives Ruby an edge over its competitors. Semantics of these operators can be changed due to the object oriented nature of the language.
Nil is not a data type .
Require() loads and processes the Ruby code from a separate file, including whatever classes, modules, methods, and constants are in that file into the current scope. Loads() performs the inclusion operation once, it reprocesses the code every time load is called.