This is simple ruby script.
Ruby print to console variable.
Usr bin ruby print apple print apple n puts orange puts orange the print and puts methods produce textual output on the console.
Also you ll need to append r at end of line to indicate carriage return and do next print at beginning of current line.
Puts print and stdin use the console window.
How to print something.
Print apple print apple n the print method prints two consecutive apple strings to the terminal.
New ruby print variable to console.
So far we have mostly used the method puts to do that.
In our case the argument is a string message delimeted by double quotes.
The difference between the two is that the latter adds a new line character.
Learn how to use the ruby gets method with this guide.
Call the puts p print and stdin readline methods.
It will print this is ruby message to the console.
Usr bin ruby this is a path to the ruby interpreter which will execute the script.
Puts statement in ruby automatically adds a new line how do i avoid it.
Many of the exercises that you do while doing your first steps with ruby basics include running a short ruby program that outputs something to the terminal.
Puts this is ruby the puts is a ruby keyword which prints its argument to the terminal.