Skip to content
On this page

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class · Ruby 3.4

Prism::UnlessNode

< Prism::Node 20 instance methods 2 class methods

Represents the use of the unless keyword, either in the block form or the modifier form.

bar unless foo
^^^^^^^^^^^^^^

unless foo then bar end
^^^^^^^^^^^^^^^^^^^^^^^

Class methods 2

Instance methods 20

Attributes

The else clause of the unless expression, if present.

unless cond then bar else baz end
                     ^^^^^^^^
Read

The condition to be evaluated for the unless expression. It can be any [non-void expression](github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).

unless cond then bar end
       ^^^^

bar unless cond
           ^^^^
Read

The body of statements that will executed if the unless condition is falsey. Will be nil if no body is provided.

unless cond then bar end
                 ^^^