class AST::ForLoop attr_reader :iterator, :iterable, :block def initialize(iterator, iterable, block) @iterator = iterator @iterable = iterable @block = block end def ==(other) other.is_a?(AST::ForLoop) && other.iterator == @iterator && other.iterable == @iterable && other.block == @block end def execute(env) @iterable.execute(env).each do |i| _env = Environment.new _env.set(@iterator.name, i) @block.execute(_env) end end end