Ruby syntax


  Translation results:

Ruby is an open source server-side scripting language for object-oriented programming. It was designed and developed by Yukihiro Matsumoto in Japan in the mid-1990s. In the Ruby community, Matsumoto is also known as Matz. Ruby runs on multiple platforms such as Windows, MAC OS, and various versions of UNIX.

Ruby syntaxsyntax

Whitespace characters such as spaces and tabs are generally ignored in Ruby code, except when they appear in a string. However, sometimes they are used to explain ambiguous statements. This interpretation produces a warning when the -w option is enabled.

Ruby syntaxexample

#!/usr/bin/ruby -w
# -*- coding : utf-8 -*-
print <<EOF
This is the first way to create a document here.
Multi-line string. EOF
print <<"EOF";                 # Same as above
This is the second way to create a document here.
Multi-line string. EOF
print <<`EOC`                                                                                          
echo hi there
echo lo thereEOC
print <<"foo", <<"bar" # You can stack them
I said foo.foo
I said bar.bar

Popular Recommendations

Home

Videos

Q&A