HomeSOFTWAREWhat Is Ruby Programming Language

What Is Ruby Programming Language

Ruby is an object-oriented programming language developed by Japanese computer scientist Yukihiro Matsumoto in the 1990s. The first version of Ruby was released in 1995, and in 2012 the language was standardized under ISO/IEC 20170 as an international standard. Like JavaScript or PHP programs, Ruby programs are also interpreted at runtime. In addition to object orientation, the language supports procedural and functional programming, dynamic typing, garbage collection, and reflection. Ruby can be used free of charge. There are complimentary interpreters for the various platforms.

Pros And Cons Of Ruby

Web application frameworks such as Sinatra or Rails make Ruby the ideal language for the web. Rails were introduced in 2004 and simplified the creation of database-driven websites. Ruby is particularly popular for quickly creating simple, object-oriented programs. Other advantages of this language are:

  1. the ability to call functions of the operating system
  2. powerful string operations and regular expressions
  3. no variable declaration is necessary
  4. no typing of variables
  5. simple and consistent syntax
  6. automatic memory management
  7. everything is an object
  8. classes, methods, inheritance

The main advantage of an interpretive language is that it is portable to different operating system platforms and hardware architectures. A compiled application often only runs on the operating system or hardware for which it was built. Ruby programs run without modifications on an Intel system with Linux, Windows, or Mac OS X. The Ruby code can be written directly into the interpreter and executed in real time as an additional advantage. This is a valuable function, especially for commands that need to be completed quickly. The main disadvantage of a Ruby program is the speed of execution. Because the source code must be interpreted at runtime, a Ruby application is slower than compiled programs. In addition, the program code can be read by anyone, which is not a problem in open-source software. However, for some commercial applications, this may not be acceptable.

Ruby’s Syntax

The object-oriented programming language uses classes and methods. Classes are presented with the ” class ” keyword. The ” def ” keyword characterizes methods. All blocks end with ” end. ” Instance variables of a class contain a main ” @, “global variables a main ” $ ” character. Methods are called ” initialize. ” Script program records can be made with a standard content manager. You get the extension ” .rb. ” Comment lines are isolated by a ” #” and disregarded by the interpreter. A semicolon at the end of a line or a new line is interpreted as the end of a statement. Several reserved words cannot be used as constants or variables.

Here Are Some Syntax Examples

#1 / usr / bin/ruby -w

puts “Hello World!”;

Results: Hello World!

Running a script:

$ Ruby test.rb

The END statement:

END {

code

}

#!/usr/bin/ruby

puts “This Is A Ruby-Program.”

END {

puts “Ends Ruby-Programm” }

BEGIN {

puts “Initialize Ruby-Programm” }

brings the following result:

Initialize Ruby-Programm

This Is A Ruby-Program

Ends Ruby-Programm

Why Is Language So Popular?

Ruby is a modern programming language that is exceptionally simple to learn. Like Perl, Ruby is a broadly valuable language. Composing total applications with a GUI can be utilized. The language is likewise pervasive for making dynamic sites with information base access. The language is natural, adaptable, and extremely simple to expand. New capabilities can be added by incorporating uninhibitedly accessible libraries from the local area.

Also Read: How To Install Python And How To Program Online

Technology Talkerhttps://www.technologytalker.com
Technology Talker is a well built blog which Provides you with all the Latest news about Technology, business, Marketing, Social Media etc.
RELATED ARTICLES

Latest Articles