Hello, first post here...
Well I've just(today) started using Ruby, but it's not my first programming language...
When just playing a bit with the basics, and got a really weird problem, I can't get the if statements to work...
I have this code.
Code:
name = gets()
puts '#{name}'
if name == 'Rune' then
puts 'hello'
elsif name == 'Casper' then
puts 'fork'
else
puts 'it didn't work'
end
I run it and type in Rune, and i get this output:
Code:
Rune
it didn't work
The variable does contain the right string, but it skips to the else code-block... I just can't seem to figure out what's wrong!
I've tried using the case statement, same thing happened, just skips to the else statement... (I've also tried the different syntaxes of the statements)
Please, can someone tell my what's wrong..?
Best regards Rune B