Mercurial > repos > other > SevenLanguagesInSevenWeeks
view 1-Ruby/blocks-irb.output @ 38:e8407d4e72dd
Add code on reflection - basically involves the object returned by "proto" message
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 13 Sep 2017 20:11:52 +0100 |
parents | 0374ae06729e |
children |
line wrap: on
line source
blocks.rb(main):001:0> #! /usr/bin/env ruby blocks.rb(main):002:0* blocks.rb(main):003:0* x = 1 => 1 blocks.rb(main):004:0> blocks.rb(main):005:0* # Inline loops blocks.rb(main):006:0* x = x + 1 while x < 10 => nil blocks.rb(main):007:0> puts x 10 => nil blocks.rb(main):008:0> blocks.rb(main):009:0* x = x - 1 until x == 1 => nil blocks.rb(main):010:0> puts x 1 => nil blocks.rb(main):011:0> blocks.rb(main):012:0* # Conventional loops blocks.rb(main):013:0* while x < 10 blocks.rb(main):014:1> x = x + 1 blocks.rb(main):015:1> end => nil blocks.rb(main):016:0> puts x 10 => nil blocks.rb(main):017:0> blocks.rb(main):018:0* until x == 1 blocks.rb(main):019:1> x = x - 1 blocks.rb(main):020:1> end => nil blocks.rb(main):021:0> puts xblocks.rb(main):021:0> 1 => nil blocks.rb(main):021:0>