Represents the use of the ‘for` keyword.

for i in a end
^^^^^^^^^^^^^^
Attributes
Read

The index expression for ‘for` loops.

for i in a end
    ^
Read

The collection to iterate over.

for i in a end
         ^
Read

Represents the body of statements to execute for each iteration of the loop.

for i in a
  foo(i)
  ^^^^^^
end
Class Methods

Initialize a new ForNode node.

Return a symbol representation of this node type. See ‘Node::type`.

Instance Methods

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

def accept: (Visitor visitor) -> void

def child_nodes: () -> Array[nil | Node]

def comment_targets: () -> Array[Node | Location]

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?index: LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | BackReferenceReadNode | NumberedReferenceReadNode | MissingNode, ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode

An alias for child_nodes

def do_keyword: () -> String?

The location of the ‘do` keyword, if present.

for i in a do end
           ^^

def end_keyword: () -> String

The location of the ‘end` keyword.

for i in a end
           ^^^

def for_keyword: () -> String

The location of the ‘for` keyword.

for i in a end
^^^

def in_keyword: () -> String

The location of the ‘in` keyword.

for i in a end
      ^^

def inspect -> String

Save the do_keyword_loc location using the given saved source so that it can be retrieved later.

Save the end_keyword_loc location using the given saved source so that it can be retrieved later.

Save the for_keyword_loc location using the given saved source so that it can be retrieved later.

Save the in_keyword_loc location using the given saved source so that it can be retrieved later.

Return a symbol representation of this node type. See ‘Node#type`.