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.



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

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.



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

def end_statement=(value)
  @end_statement = value
end

Instance Method Details

#execute(runtime) ⇒ Object



14
15
16
# File 'lib/basic101/else_statement.rb', line 14

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

#goto_following_statement(runtime) ⇒ Object



18
19
20
# File 'lib/basic101/else_statement.rb', line 18

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