Interactive Ruby Shell: Difference between revisions

Content deleted Content added
External links: fixing book links
No edit summary
Line 5:
 
Example usage:
<source lang="ruby">
irb(main):001:0> n = 5
=> 5
irb(main):002:0> def fact(n)
irb(main):003002:10> def if fact(n <= 1)
irb(main):004003:21> if n <= 1
irb(main):005004:2> else 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
</source>
 
 
==See also==