Mercurial > repos > other > SevenLanguagesInSevenWeeks
annotate 1-Ruby/day1.rb @ 76:5860845f5dac
Create module with synchronous translation and notes on how to run
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 03 Feb 2018 20:25:47 +0000 |
parents | 3e4ea3d47880 |
children |
rev | line source |
---|---|
13 | 1 #! /usr/bin/env ruby |
2 | |
3 puts 'Hello, World' | |
4 puts 'Hello, Ruby'.index('Ruby') | |
5 i = 1 | |
6 | |
7 while i <= 10 | |
8 puts "This is sentence number #{i}" | |
9 i = i + 1 | |
10 end | |
11 | |
12 | |
13 randNum = rand(10) | |
14 guess = 11 | |
15 until guess == 'q' or guess.to_i == randNum | |
16 puts 'Guess the number (0-9) or "q" to quit' | |
17 guess = gets.strip | |
18 end | |
19 | |
20 puts "Well done! The number was #{randNum}" unless guess == 'q' |