Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

TrueClass#|

true | obj → true

Or—Returns true. As obj is an argument to a method call, it is always evaluated; there is no short-circuit evaluation in this case.

Example
true |  puts("or")
true || puts("logical or")

produces:

or
See also #^ #inspect #=== #to_s also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1