Different commands for the same purpose in Ruby
The Ruby programming language is free and open source. It is both object-oriented and interpretive. Yukihiro Matsumoto invented Ruby. Ruby’s founder referred to it as the jewel of programming languages because it was named after a gemstone. Here, we’ll talk about the various Ruby commands.
The following criteria were taken into account during the development of Ruby:
- Simplicity
- Extensiveness
- Completeness
- Portability
Most UNIX-based platforms support Ruby. Ruby was primarily developed on Linux. Common platforms like Windows, DOS, macOS, etc., are all compatible with Ruby.
1. Print Educative Answer in RUBY
puts "Educative, Answer!"
2. BEGIN statement to print line in the start
puts "This statement comes later"BEGIN {puts "This statement will be printed in the beginning"}
3. EOF statement to print multiple lines
print <<"EOF";Multiple line string.1:E2:D3:U4:C5:A6:T7:I8:V9:EEOF
4. EOC command to print multiple lines
print <<`EOC`echo Eecho Decho Uecho Cecho Aecho Techo Iecho Vecho EEOC
5. Ruby END statement to print line in the end
puts "This is main body"END {puts "This block executes in the end"}BEGIN {puts "This block executes in the beginning"}
6. Stacking command to print multiple lines
print <<"Answers", <<"Courses" # you can stack themEducative Answers is a valuable platform.AnswersEducative courses can provide deep view of you selected course.Courses
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved