[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

David Stanislaus

6/9/2008 11:55:00 PM

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.
--
Posted via http://www.ruby-....

2 Answers

David Stanislaus

6/10/2008 1:22:00 AM

0

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.
--
Posted via http://www.ruby-....

Victor Reyes

6/10/2008 12:42:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Mon, Jun 9, 2008 at 9:21 PM, David Stanislaus <stanislaus_d@hotmail.com>
wrote:

> 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.
> --
> Posted via http://www.ruby-....
>
>
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