From: Simon Anker Date: 2008-07-31T08:58:37+09:00 Subject: Re: Another Deaf Grandma Topic, different issue I think I've spent maybe two hours or more solving this, but I finally got it in the end.. I hope so anyway :) .. I have done a bit of a Python tutorial a bit ago, so I think I have a bit of more experience than Phee, but not much! So don't yell at me! :) Phee, try inputting "BYE", "BYE", "test". I made the same mistake a bunch of times. Also your indenting is a bit off. Look at the example in the "A Little Bit of Logic" section of Chapter 6 to get it right. I've edited your second program to look nicer, comments below: you = gets.chomp byes = 0 while byes != 2 if you=='BYE' byes += 1 else byes=0 end if you != you.upcase puts 'HUH?! SPEAK UP, SONNY!' else puts 'NO, NOT SINCE 19'+(rand(21)+30).to_s+'!' end you = gets.chomp end "byes += 1" is just another way of writing "byes = byes + 1". This haven't been stated any where in the tutorial though. Nor have the count concept as far as I know, but I don't see how to do the exercise without it, unless you do it with rather ugly code. I've removed all the "then" statements as they are unnecessary. I don't know where you picked those up, as I haven't seen them in the tutorial ;O .. I assume we're doing the same one (I'm doing this: http://pine.fm/LearnToProgram/). Anything that isn't "!= you.chomp.upcase" IS "== you.chomp.upcase", so I could remove that third "if" question as well. Think of it like two negatives making it positive (1 - (-1) = 2). You don't really need those .chomp's in the while loop when you do it when you get the string (gets). I guess they can be helpful if someone forgets to put a chomp on the end of gets, or you only need the string to be chomp'ed occasionally, but that isn't the case here. What I did to solve it was to make the while loop run until the program turned it off, like this (example could be a very personalised music player on your pc): keepPlaying = 1 while keepPlaying != 0 if music_I_like_is_playing == True else keepPlaying = 0 end end Basicly an on/off switch. -- Posted via http://www.ruby-forum.com/.