Basic Ruby Example

Ruby is not only a flexible scripting language in terms of syntax, but it is also extremely flexible in terms of how scripts can be executed. In this section, we’ll look at some simple Ruby examples to learn Ruby before diving into the various ways Ruby code can be executed.

The most basic example we come across in the programming world is to print out ‘HELLO WORLD’. So, here also, we will be covering the simple ruby examples to learn Ruby to display a print output of ‘Hello Ninjas! Please look forward to learn simple Ruby examples.’.

Coding ninjas

Example:

print "Hello Ninjas! Please look forward to learn simple Ruby examples."

You can also try this code with Online Ruby Compiler

Run Code

Output:

Output of Ruby Example

Here, we only required one line to print the output, whereas the most basic tasks require a significant amount of code structure in programming languages like C++, Java, etc.

Get the tech career you deserve, faster!

Connect with our expert counsellors to understand how to hack your way to success

User rating 4.7/5

1:1 doubt support

95% placement record

Akash Pal

Senior Software Engineer

326% Hike After Job Bootcamp

Himanshu Gusain

Programmer Analyst

32 LPA After Job Bootcamp


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *