Suite de Fibonacci
Description du code
Exemple de récursion en RubyCode source ou contenu du fichier
Code Ruby (Suite de Fibonacci) (15 lignes)
parse arg n If n < 1 Then Do n = 1 End R = fib(N) say R exit fib: PROCEDURE PARSE ARG N IF N<2 THEN RETURN 1 RETURN fib(N-2) + fib(N-1)
Autres extraits de codes en Ruby
- Suite de Fibonacci Exemple d'itération en Ruby
- Suite de Fibonacci Exemple de récursion en Ruby
- Tous les extraits
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 05/10/2009, last modified the 28/10/2018
Source of the printed document:https://www.gaudry.be/en/sniplet-rf-ruby/fibonacci-rec.rhtml.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.