Interactive Ruby Shell: Difference between revisions

Content deleted Content added
m Uasge caption
No edit summary
Line 5:
Program usage:
irb [ options ] [ ''programfile'' ] [ ''argument...'' ]
 
Example usage:
irb(main):001:0> n = 5
=> 5
irb(main):002:0> def fact(n)
irb(main):003:1> if n <= 1
irb(main):004:2> 1
irb(main):005:2> else
irb(main):006:2* n * fact(n - 1)
irb(main):007:2> end
irb(main):008:1> end
=> nil
irb(main):009:0> fact(n)
=> 120
 
 
==External links==