Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board Fib Seq in Ruby Download Source Code
Author Details Code Information
Damner ( Dominik )

Pinned 4 Codes
Posted 1 Coding Articles

Send A Message
View Coders Profile
Language Ruby
Expires Never
Length 323 Characters (18 Lines)
Password no password
Description

Something I did for practice. :) Rubys fun.
  1. #fib.rb
  2. #Testing my ruby skills, basically a Fibonnaci sequence genetator in ruby, with a built in tester.
  3.  
  4. #sequence generator
  5.  
  6. def fib(n)
  7.   return n if (0..1).include? n
  8.   fib(n-1) + fib(n-2)
  9. end
  10.  
  11. #tester
  12.  
  13. puts "To which nth do you want to display "
  14. n = gets.chomp.to_i
  15.  
  16. n.times do |i|
  17.        puts fib(i+1)
  18. end
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
Page 1 of 1
 
 
Latest News About Coder Profile
Coder Profile Poll
Do you use RSS feeds?

Yes, all the time, first thing i do on the net
Sometimes, when i remember to check them
No, can't be bothered with them
No, what are they?


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
41 Days Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2009, Scott Thompson, All Rights Reserved