Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. Hello World the program is the most basic and first program when we start a new programming language. This simply prints Hello World on the screen. Below is the program to write hello world”.
How to run a Ruby Program on different platform?
With Online IDE :
We can use various online IDE. which can be used to run Ruby programs without installing.
Above code will run on online IDE. Here, puts keyword is used to print any thing on the screen.
With Linux :
Using Command-Line Firstly, open a text editor Notepad or Notepad++. write the code in the text editor and save the file with (.rb) extension. open the command prompt follow step by step process on our system.
To run the
hello.rb Ruby script, run the command ruby
hello.rb it will print the output.
With Window :
Using Command-Line write ruby -v on command line window to show ruby version. Below is the image to better understand.
To start the IRB prompt, open your command-line and run the irb command. after this we can write the ruby code and it will run on command line.
In above image we use puts keyword to print the output and it returned nil.
- Private Classes in Ruby
- Ruby | Matrix cofactor() function
- Ruby Integer odd? function with example
- Ruby Integer div() function with example
- Ruby | Symbol to_s function
- Ruby | Set replace() function
- Ruby | Set reset() function
- Ruby For Beginners
- Ruby | Array Concatenation using (+) function
- Ruby | at() function
- Ruby Float to_r() method with example
- Ruby | Keywords
- Ruby | Exception Class and its Methods
- Ruby | String inspect Method
- Ruby | Numeric imaginary() function
- Ruby | Numeric i() function
- Ruby | Numeric fdiv() function
- Ruby | String hex Method
- Ruby | String include? Method
- Ruby | Hash each_pair() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.