Intro to Ruby


#1



I am having trouble with this exercise can you guys help me.

'puts' and 'print'
The print command just takes whatever you give it and prints it to the screen. puts (for "put string") is slightly different: it adds a new (blank) line after the thing you want it to print. You use them like this:

puts "What's up?"
print "Oxnard Montalvo"
No parentheses or semicolons needed!

Instructions
In the editor, use at least one print statement and at least one puts statement. You can print out any strings you like! (Make sure to put your strings between quotes, like this: "Hello!".)


Replace this line with your code.


#2

What is the issue? There seems to be nothing to reply to.


#3

I having trouble with the exercise.
I put this into the program

puts
"Hello"

i try

"Puts"
"Hello"

tried

puts "What's up?"
print "Oxnard Montalvo"

the example in ruby

None of these work

what am I doing wrong?

thanks for the Help


#4

#5

Use the instructions to determine which of the ones you tried is the one you're supposed to do.
You can also google for examples eg "ruby puts example"
(Stop guessing, find out which one it is)

And then if that's not "working", proceed by considering what "not working" means, in what way does it now behave differently from what you want? In order to change the behaviour you need to know in what way it behaves differently from what you want. (Saying "not working" is a bit like ignoring what happens and not observing the situation)


#6

You've got considerations like

  • was anything printed?
  • did one of puts/print have the desired effect but not the other?
  • was it codecademy that gave an error?
  • was it ruby that gave an error?
  • is it you that don't like the outcome?
  • what was the error?
  • does the code look just like the examples?

Those are some of the clues you need to use, both in trying to solve it yourself and when explaining the problem so that somebody else can understand what prevents you from figuring it out


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.