7stud -- wrote: > What output do you get for this: > puts 'No not since 19' + (rand(5)).to_s + (rand(10)).to_s + '!' i get "No not since [1900-1949] intergers only > and what about this: > > puts rand(5) 0-4 intergers only > puts rand(10) 0-9 intergers only > >> for >> instance i wanted it to be like the tutorial said and make it 1930- 1950 >> for the year > > For the 30-50 part, how about getting a random number that is greater > than or equal to 0 and less than 20 and then adding 30 to it? > hmmmm i think i tried something like that and got the cannot convert fixnum into string error many times or something it seems ill have to play with the rand method more ahhh i remember i had a problem figuring out how to add intergers and then convert the sum into a string > >> 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] > > In your opinion, what does the last line here do: > >> reply = gets.chomp >> if reply == reply.upcase >> puts 'No not since 19' + (rand(5)).to_s + (rand(10)).to_s + '!' >> reply = gets.chomp > reply = gets.chomp? that means im resetting the variable named reply to equal the method get string so that it will be whatever i manually enter with the chomp method so that it ignores my enter keystroke in a broader sense it keeps me in the loop section of the program while providing a way out. im sorry i know im a naturally dense person and i do not get where your going with that one > >> 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. >> > > Your code is a mess. You need to choose an indenting format. Here is > what I recommend: > > x = 1 > > while x != 10 > if x == 1 > puts "hello" > end > > break #im sorry is this a command or just showing you put a line between #them? > end > > > Note: > > 1) The first "end" is indented the same amount as 'if', and denotes the > end of the if statement. > 2) Everything inside the while statement is indented more than 'while' > 3) The last 'end' matches the indenting of 'while', and denotes the end > of the while loop. > > Without proper indenting, you will never be able to follow the logic of > your code. Wow i guess i was right not to post what i first had as this is the cleaned up version <.< as i said im very new to this and im sorry perhaps ill get more ocd at it with time here lemme try to fix it lol 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 + '!' #Sorry reply = gets.chomp else puts 'WHAT\'S THAT SONNY SPEAK UP!' reply = gets.chomp end end #ahh i see what you mean i have no idea what this belongs too x.x #im guessing one of the whiles this being all the way up here while the other #is at the bottom makes me think that possibly it is one of the problems #bah i tried it it isnt still one step forward for understanding. 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?' # sorry forum post wont let me line this up right 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...' i had a little problem keeping up with the ends and how many i needed i expected the 'orderedness' to come with practice Once again im sorry i realise this is a newb question for a newb program and i remeber how i hated frivolous newb WoW questions. But he who asks a question is a fool for five minutes. he who doesnt is a fool forever. but i dont even know what to type in the google bar for this and after i spent 6 hours not going anywhere with it i decided to find people to help and this looked like the best site i found so far i think i was right as my brother told me this program would get laughed at as i said im proud of it its my first one i did the hello world and a program that got your name and added all the chars together but those just did not impress me like this one did. =) hmm i think that wraps up this post i look foward to your next reply =) -- Posted via http://www.ruby-forum.com/.