diff options
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/doc.txt | 4 | ||||
-rwxr-xr-x | ruby/guess.rb | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ruby/doc.txt b/ruby/doc.txt new file mode 100644 index 0000000..b0b8476 --- /dev/null +++ b/ruby/doc.txt @@ -0,0 +1,4 @@ +API: + http://ruby-doc.org/core-1.9.3puts/ +Pragmatic: + http://www.ruby-doc.org/docs/ProgrammingRuby/ diff --git a/ruby/guess.rb b/ruby/guess.rb new file mode 100755 index 0000000..8ead21d --- /dev/null +++ b/ruby/guess.rb @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby + +n = rand(100) +guess = -1 +while guess != n + print "Introduce numero: " + guess = gets.to_i + puts "Demasiado bajo" if guess < n + puts "Demasiado alto" if guess > n +end + +puts "Bien!" |