From ab98c8c8ae51ef5b6c7c23a5c10fce5dc07a2a53 Mon Sep 17 00:00:00 2001 From: david anderson Date: Sat, 10 Sep 2016 09:45:25 +0100 Subject: [PATCH 1/4] initial commit empty file --- chris_pine.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 chris_pine.rb diff --git a/chris_pine.rb b/chris_pine.rb new file mode 100644 index 000000000..e69de29bb From da2843028e5adc921c7cc6885a7efb49d01aeac2 Mon Sep 17 00:00:00 2001 From: david anderson Date: Sat, 10 Sep 2016 10:49:55 +0100 Subject: [PATCH 2/4] chapter09 ask solution --- chris_pine_ch09.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 chris_pine_ch09.rb diff --git a/chris_pine_ch09.rb b/chris_pine_ch09.rb new file mode 100644 index 000000000..c791d07a9 --- /dev/null +++ b/chris_pine_ch09.rb @@ -0,0 +1,10 @@ +def ask question + while true + puts question + reply = gets.chomp.downcase + return true if reply == "yes" + return false if reply == "no" + puts "Please answer yes or no." + end +answer +end From 2c5035b3c02540cb512f5cdfc34261ef92aca1c1 Mon Sep 17 00:00:00 2001 From: david anderson Date: Sat, 10 Sep 2016 10:51:33 +0100 Subject: [PATCH 3/4] chapter09 --- chris_pine.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chris_pine.rb b/chris_pine.rb index e69de29bb..ed4efdd6f 100644 --- a/chris_pine.rb +++ b/chris_pine.rb @@ -0,0 +1,6 @@ +def say_moo number_of_moos + puts "moooooo...."* number_of_moos + "yo" +end + +puts say_moo 3 From d589953bc00b194fdeba9a45ec03253179c55a68 Mon Sep 17 00:00:00 2001 From: david anderson Date: Sat, 10 Sep 2016 10:55:08 +0100 Subject: [PATCH 4/4] another attempt at ch09 ask --- chris_pine_ch09.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/chris_pine_ch09.rb b/chris_pine_ch09.rb index c791d07a9..74cf71724 100644 --- a/chris_pine_ch09.rb +++ b/chris_pine_ch09.rb @@ -2,9 +2,13 @@ def ask question while true puts question reply = gets.chomp.downcase - return true if reply == "yes" - return false if reply == "no" - puts "Please answer yes or no." + + return true if reply == 'yes' + return false if reply == 'no' + + puts 'Please answer "yes" or "no".' end -answer + answer # This is what we return (true or false). end + +# puts(ask('Do you like eating tacos?'))