Class: Basic101::ElseStatement

Inherits:
Statement show all
Defined in:
lib/basic101/else_statement.rb

Instance Attribute Summary collapse

Attributes inherited from Statement

#index, #line

Instance Method Summary collapse

Methods inherited from Statement

#data_items, #exec, #line_number, #raise_error_with_line_number

Methods included from Identity

#==

Constructor Details

#initializeElseStatement

Returns a new instance of ElseStatement.



9
10
# File 'lib/basic101/else_statement.rb', line 9

def initialize
end

Instance Attribute Details

#end_statement=(value) ⇒ Object (writeonly)

Sets the attribute end_statement

Parameters:

  • value

    the value to set the attribute end_statement to.



7
8
9
# File 'lib/basic101/else_statement.rb', line 7

def end_statement=(value)
  @end_statement = value
end

Instance Method Details

#execute(runtime) ⇒ Object



12
13
14
# File 'lib/basic101/else_statement.rb', line 12

def execute(runtime)
  @end_statement.goto_following_statement(runtime)
end

#goto_following_statement(runtime) ⇒ Object



16
17
18
# File 'lib/basic101/else_statement.rb', line 16

def goto_following_statement(runtime)
  runtime.goto_index(@index + 1)
end