Created
March 10, 2015 01:14
-
-
Save lonefreak/b069a294133319cfe808 to your computer and use it in GitHub Desktop.
A short ruby program to randomly choose between some programming languages
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/ruby | |
#pick a programming language | |
def get_language() | |
known_languages = ["ruby","javascript","php","java","perl"] | |
special_languages = ["python","go","scala","clojure","groovy"] | |
roll = rand(0..5) | |
return special_languages[roll] unless roll == 5 | |
return known_languages[rand(0..4)] | |
end | |
puts get_language() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment