Ruby Hello World Example- How To Write and Execute Ruby Program on Ubuntu 20.04

Ruby Hello World Example- How To Write and Execute Ruby Program on Ubuntu 20.04

 Ruby is an interpreted, high-level, general-purpose programming language which supports multiple programming paradigms.

apt update ; apt-get install ruby -y
whereis ruby
which ruby

nano helloworld.rb
#!/usr/bin/ruby

# Hello world ruby program

puts "Hello World!";

ruby helloworld.rb
( or )
chmod u+x helloworld.rb
./helloworld.rb

Executing Ruby one liner - ruby -e 'puts "Hello World!\n"'




Share on Pinterest
Share on LinkedIn
Share on WhatsApp
Share on Telegram