Skip to content

Instantly share code, notes, and snippets.

@mookjp mookjp/rand.rb
Last active Dec 13, 2015

What would you like to do?
DAY1, Ruby - Seven languages self study
random_num = rand(10)
puts "Random number is " + random_num.to_s + "\n"
if gets.to_i > random_num
puts "Your number is high\n"
puts "Your number is low\n"
# Print "Hello, world"
puts "Hello, world"
# Print the index of "Ruby"
puts "Hello, Ruby".index("Ruby")
# Print "My name" in 10 times
for i in 1..10:
puts "My name\n"
# print "This is sentence number" with the times
for i in 1..10:
puts "This is sentence number " + i.to_s + "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.