Class Nodes.UnlessNode

java.lang.Object
org.prism.Nodes.Node
org.prism.Nodes.UnlessNode
Enclosing class:
Nodes

public static final class Nodes.UnlessNode extends Nodes.Node
 Represents the use of the `unless` keyword, either in the block form or the modifier form.

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

     unless foo then bar end
     ^^^^^^^^^^^^^^^^^^^^^^^
 
  • Field Details

    • predicate

      public final Nodes.Node predicate
       The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
      
           unless cond then bar end
                  ^^^^
      
           bar unless cond
                      ^^^^
       
    • statements

      public final Nodes.StatementsNode statements
       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
                            ^^^
       
    • else_clause

      public final Nodes.ElseNode else_clause
       The else clause of the unless expression, if present.
      
           unless cond then bar else baz end
                                ^^^^^^^^
       
  • Constructor Details

  • Method Details