# I'm New

**URL:** <https://www.ruby-forum.com/t/im-new/140005>\
**Category:** Ruby\
**Created:** [June 10, 2008, 1:54am UTC](https://www.ruby-forum.com/t/im-new/140005 "2008-06-10T01:54:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [June 10, 2008, 1:54am UTC](https://www.ruby-forum.com/t/im-new/140005/1 "2008-06-10T01:54:13Z")

</div>

First of all, let me just express my happiness at finally finding a  
forum for Ruby, with a considerable base of users, (20 mins on a search  
engine) Lol

Yeah I’m new  
new to everything, I just decided to get into programming searched  
programming found ruby and started following a guide.

I’ve had no programming experience before so if you guys know of  
anything to help me out I might take a look at it.

and also I’ve got this little program problem:

puts ‘Speak up Sonny I can’t hear you.’  
talk = gets.chomp  
if talk == talk.capitalize or talk.downcase  
then puts ‘What? Sonny speak louder! Like THIS.’  
if talk == talk.upcase  
then puts ‘no not since’  
end  
end

When you run it, and say something in Caps it returns both if puts  
things so I don’t know how to fix it.  
thanks.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [June 10, 2008, 3:12am UTC](https://www.ruby-forum.com/t/im-new/140005/2 "2008-06-10T03:12:17Z")

</div>

From: removed\_email\_address@domain.invalid [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

# puts ‘Speak up Sonny I can't hear you.’

# talk = gets.chomp

# if talk == talk.capitalize or talk.downcase

# then puts ‘What? Sonny speak louder! Like THIS.’

# if talk == talk.upcase

# then puts ‘no not since’

# end

# end

welcome to ruby!

simplify your program by asking simple/few if questions, and deducing fr  
it.

compare it eg w,

puts “SPEAK up, Sonny, I can’t hear you.”  
talk = gets.chomp  
if talk == talk.upcase  
puts ‘no not since’  
else  
puts ‘What? Sonny, speak louder! Like THIS.’  
end

# When you run it, and say something in Caps it returns both if puts

# things so I don’t know how to fix it.

you had a problem along this line,

if talk == talk.capitalize or talk.downcase

talk.downcase always return true, ergo the whole or expression/condition  
always returns true.

maybe you wanted

if talk == talk.capitalize or talk==talk.downcase

as you progess, you’ll probably then realize that this is a trivial  
problem that you yourself can handily fix.

read more about ruby expressions and control structures. breakup  
problems into smaller problems.

use irb. run one statement/expression at a time. check all possible  
cases.

go slow first. stop if you need rest, but keep on studying/programming  
😉

hth.

kind regards -botp

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [June 10, 2008, 3:21am UTC](https://www.ruby-forum.com/t/im-new/140005/3 "2008-06-10T03:21:40Z")

</div>

When I ran:

puts ‘Speak up Sonny I can’t hear you.’  
talk = gets.chomp  
if talk == talk.capitalize or talk == talk.downcase  
then puts ‘What? Sonny speak louder! Like THIS.’  
if talk == talk.upcase  
then puts ‘no not since’  
end  
end

and used Caps it just ended the program… sorry if this is too trivial,  
if it is maybe you guys could recommend a place where I wont be a  
bother,

either way thanks.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [June 10, 2008, 3:24am UTC](https://www.ruby-forum.com/t/im-new/140005/4 "2008-06-10T03:24:12Z")

</div>

NVM, I fixed it,

urgh sorry,

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [June 10, 2008, 4:37am UTC](https://www.ruby-forum.com/t/im-new/140005/5 "2008-06-10T04:37:05Z")

</div>

From: David Stanislaus [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

# puts ‘Speak up Sonny I can't hear you.’

# talk = gets.chomp

# if talk == talk.capitalize or talk == talk.downcase

# then puts ‘What? Sonny speak louder! Like THIS.’

# if talk == talk.upcase

# then puts ‘no not since’

# end

# end

# and used Caps it just ended the program… sorry if this is

# too trivial,

# if it is maybe you guys could recommend a place where I wont be a

# bother,

we are glad that you are doing your best.

your if is structured like this,

if talk == talk.capitalize or talk == talk.downcase  
puts ‘What? Sonny speak louder! Like THIS.’

if talk == talk.upcase  
puts ‘no not since’  
end  
end

wc means that the 2nd if is nested inside the first if, ergo it does not  
get called if you entered all caps.

another tip: use indentions (wisely)

kind regards -botp

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [June 10, 2008, 2:42pm UTC](https://www.ruby-forum.com/t/im-new/140005/6 "2008-06-10T14:42:59Z")

</div>

On Mon, Jun 9, 2008 at 9:21 PM, David Stanislaus  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> and used Caps it just ended the program… sorry if this is too trivial,  
> if it is maybe you guys could recommend a place where I wont be a  
> bother,
> 
> ## either way thanks.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

David,

Although I am not sure what is it that you are trying to do, the  
following  
is one way to re-write your code and it does not abend!

\*puts “Speak up Sonny I can't hear you”  
talk = gets.chomp

if talk == talk.capitalize or talk == talk.downcase  
puts “What? Sonny speak louder! Like THIS.”  
else  
if talk == talk.upcase  
puts “no not since”  
end  
end\*

But why don’t you tell us what you are trying to do and the forum might  
be  
able to recommend something better.

One last thing, beginner or not you don’t bother anyone. I am also still  
a  
beginner. Granted, you’ll find people that do not want to deal with  
people  
like you or I, but then you find another dozen that really will help us.

Victor
