Sha256: 497c6081f7bfc5623e1f34d6ccac4b5ecd529ad0851c1fc40ee4b328037ef1a4
Contents?: true
Size: 503 Bytes
Versions: 3
Compression:
Stored size: 503 Bytes
Contents
require_relative 'statement' module Basic101 class IfStatement < Statement attr_writer :else_statement def initialize(condition) @condition = condition end def end_statement=(statement) @else_statement.end_statement = statement end def execute(runtime) if @condition.eval(runtime).to_f == 0 @else_statement.goto_following_statement(runtime) end end protected def state [@condition, @true_statement] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-0.4.0 | lib/basic101/if_statement.rb |
basic101-0.2.0 | lib/basic101/if_statement.rb |
basic101-0.1.0 | lib/basic101/if_statement.rb |