w3resource

Ruby Basic Exercises: Get ruby version with patch number


Write Ruby program to get ruby version with patch number.

Ruby Code:

puts "Ruby Version: "+RUBY_VERSION
puts "Ruby Patch Level: "+RUBY_PATCHLEVEL.to_s

Output:

Ruby Version: 2.4.2
Ruby Patch Level: 198

Flowchart:

Flowchart: Get ruby version with patch number

Go to:


PREV : Ruby Basic Exercises
NEXT : Write a Ruby program to display the current date and time.

Ruby Code Editor:



Contribute your code and comments through Disqus.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.