Method: RubyToAnsiC#process_while
- Defined in:
- lib/ruby_to_ansi_c.rb
#process_while(exp) ⇒ Object
While block. Nothing exciting here.
662 663 664 665 666 667 668 669 670 |
# File 'lib/ruby_to_ansi_c.rb', line 662 def process_while(exp) cond = process exp.shift body = process exp.shift body += ";" unless body =~ /;/ is_precondition = exp.shift code = "while (#{cond}) {\n#{body.strip}\n}" code = "{\n#{body.strip}\n} while (#{cond})" unless is_precondition return code end |