Mercurial > repos > other > SevenLanguagesInSevenWeeks
view 1-Ruby/day1.rb @ 29:9c7af76fdbd0
Print isn't PrinLn, so add some \n characters to the output
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 06 Sep 2017 18:36:02 +0100 |
parents | 3e4ea3d47880 |
children |
line wrap: on
line source
#! /usr/bin/env ruby puts 'Hello, World' puts 'Hello, Ruby'.index('Ruby') i = 1 while i <= 10 puts "This is sentence number #{i}" i = i + 1 end randNum = rand(10) guess = 11 until guess == 'q' or guess.to_i == randNum puts 'Guess the number (0-9) or "q" to quit' guess = gets.strip end puts "Well done! The number was #{randNum}" unless guess == 'q'