-
-
Save MaximeD/1271170 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| array, places = [1,2,3,8,5,8,0,4], [] | |
| puts "Maximum value of array is #{array.max.to_s}" | |
| array.each_with_index do |val,i| | |
| places << i if val == array.max | |
| end | |
| puts "You can find #{array.max.to_s} in position #{places.join ', '}" |
2200 lignes de code :/
Je vois l'idée en gros, j'ai plus qu'à attendre d'avoir d'aussi gros softs à écrire..
ça c'est juste un fichier, hein :)
Mais t'inquiètes, je doute qu'on ait jamais quelque chose d'aussi gros à écrire que rails.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Un exemple parfait de ça est rails : https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb
Quasiment tout ce qui dépasse trois lignes est transformé en méthode, et est réutilisé ensuite sous forme du nom de la méthode.