C
Chris Logan
Hello all im really new to ruby as in a few days and getting into it. i
was following a tutorial found on
http://pine.fm/LearnToProgram/?Chapter=00 in later chapters it made a
challenge to write a program involving a looping a deaf grandma i
started it and have it for the most part working buts its doing a few
things that i dont fully understand im guessing these are bugs ?
reply = ' '
replytt = ' '
puts 'Ahh theres my grandson'
while replytt != 'BYE'
while reply != 'BYE'
reply = gets.chomp
if reply == reply.upcase
puts 'No not since 19' + (rand(5)).to_s + (rand(10)).to_s + '!'
reply = gets.chomp
else
puts 'WHAT\'S THAT SONNY SPEAK UP!'
reply = gets.chomp
end
end
if reply == 'BYE'
puts 'Do you really have to go?'
replyt = gets.chomp
reply = replyt
if replyt == 'BYE'
puts 'Don\'t you wanna hear about the time I met your granda?'
replytt = gets.chomp
replyt = replytt
reply = replyt
else
puts 'WHAT\'S THAT SONNY SPEAK UP!'
replyt = replytt
reply = replyt
reply = gets.chomp
end
end
end
puts 'Come back and visit your old granny again soon.'
puts 'Ill tell you the time I...'
puts 'zzzz...'
a few things first off since i cannot seem to find it on google i dont
know how to make rand pop out anything thats not 0- a number for
instance i wanted it to be like the tutorial said and make it 1930- 1950
for the year the second is during if reply == reply.upcase it gives me a
blank line i have to hit enter again before it gives the No not since
[year] also during the second BYE if replyt == 'BYE' even if i put an
answer that isnt in caps lock it gives it me a respons as if it was.
thats all i can remeber right now also any tips on just making the whole
thing smoother would be appreciated. I'm quite proud of this as its my
first real project i did.
was following a tutorial found on
http://pine.fm/LearnToProgram/?Chapter=00 in later chapters it made a
challenge to write a program involving a looping a deaf grandma i
started it and have it for the most part working buts its doing a few
things that i dont fully understand im guessing these are bugs ?
reply = ' '
replytt = ' '
puts 'Ahh theres my grandson'
while replytt != 'BYE'
while reply != 'BYE'
reply = gets.chomp
if reply == reply.upcase
puts 'No not since 19' + (rand(5)).to_s + (rand(10)).to_s + '!'
reply = gets.chomp
else
puts 'WHAT\'S THAT SONNY SPEAK UP!'
reply = gets.chomp
end
end
if reply == 'BYE'
puts 'Do you really have to go?'
replyt = gets.chomp
reply = replyt
if replyt == 'BYE'
puts 'Don\'t you wanna hear about the time I met your granda?'
replytt = gets.chomp
replyt = replytt
reply = replyt
else
puts 'WHAT\'S THAT SONNY SPEAK UP!'
replyt = replytt
reply = replyt
reply = gets.chomp
end
end
end
puts 'Come back and visit your old granny again soon.'
puts 'Ill tell you the time I...'
puts 'zzzz...'
a few things first off since i cannot seem to find it on google i dont
know how to make rand pop out anything thats not 0- a number for
instance i wanted it to be like the tutorial said and make it 1930- 1950
for the year the second is during if reply == reply.upcase it gives me a
blank line i have to hit enter again before it gives the No not since
[year] also during the second BYE if replyt == 'BYE' even if i put an
answer that isnt in caps lock it gives it me a respons as if it was.
thats all i can remeber right now also any tips on just making the whole
thing smoother would be appreciated. I'm quite proud of this as its my
first real project i did.