Sha256: f490c34893b7d824b5a39916db93ab113de3c8caa089eab2ed30f651588f8dc6

Contents?: true

Size: 398 Bytes

Versions: 3

Compression:

Stored size: 398 Bytes

Contents

# frozen_string_literal: true

require_relative 'statement'

module Basic101

  class LetStatement < Statement

    def initialize(reference, expression)
      @reference = reference
      @expression = expression
    end

    def execute(runtime)
      @reference.assign(runtime, @expression.eval(runtime))
    end

    protected

    def state
      [@reference, @expression]
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-1.0.2 lib/basic101/let_statement.rb
basic101-1.0.1 lib/basic101/let_statement.rb
basic101-1.0.0 lib/basic101/let_statement.rb