class FalseClass - Documentation for Ruby 4.1
Description: class FalseClass: code> is the only instance of class FalseClass and represents a logically false value in boolean expressions. code> to participate correctly in logica
Keywords: ruby,class,FalseClass

🔍

No recent searches

# class FalseClass

The global value `false` is the only instance of class `FalseClass` and represents a logically false value in boolean expressions. The class provides operators allowing `false` to participate correctly in logical expressions.

### Public Instance Methods

false & object → false
nil & object → false
Source

    static VALUE
    false_and(VALUE obj, VALUE obj2)
    {
        return Qfalse;
    }

Returns `false`:

    false & true       # => false
    false & Object.new # => false

Argument `object` is evaluated:

    false & raise # Raises RuntimeError.

true === other → true or false
false === other → true or false
nil === other → true or false
Source

    #define case_equal rb_equal

Returns `true` or `false`.

Like `Object#==`, if `other` is an instance of Object (and not an instance of one of its many subclasses).

This method is commonly overridden by those subclasses, to provide meaningful semantics in `case` statements.

false ^ object → true or false
nil ^ object → true or false
Source

    #define false_xor true_and

Returns `false` if `object` is `nil` or `false`, `true` otherwise:

    nil ^ nil        # => false
    nil ^ false      # => false
    nil ^ Object.new # => true

false | object → true or false
nil | object → true or false
Source

    #define false_or true_and

Returns `false` if `object` is `nil` or `false`, `true` otherwise:

    nil | nil        # => false
    nil | false      # => false
    nil | Object.new # => true

inspect
Alias for: to_s
to_s → "false"
Source

    VALUE
    rb_false_to_s(VALUE obj)
    {
        return rb_cFalseClass_to_s;
    }

The string representation of `false` is “false”.

Also aliased as: inspect