ruby version from script

To obtain the Ruby version from a script, you can use the RUBY_VERSION constant. Here are the steps to do it:

  1. Use the puts method to output the value of the RUBY_VERSION constant.

This will display the Ruby version that is currently running.

  1. Execute the script by running the Ruby file using the ruby command in your terminal or command prompt.
ruby your_script.rb

The Ruby version will be printed to the console when the script is executed.

By following these steps, you can easily obtain the Ruby version from a script.