Introduction – Ruby Tutorial
Ruby is a high-level, interpreted, pure object-oriented programming language used in general-purpose work progress. Ruby was designed and developed by Yukihiro Matsumoto also know as Matz in early 1995. In this Ruby tutorial, we will learn how to program in Ruby from the sketch. We will cover every single topic and basic syntax of Ruby programming language.
This guide is designed for absolute beginners. If you don’t have any prior programming experience, you can still continue learning this tutorial. After completing this tutorial, you will acquire a prior knowledge of Ruby programming concepts, procedures, and implementation techniques.
If you want to learn the more advanced concepts of ruby then you can check out the advance programming in Ruby section here.
A simple Overview of Ruby
The development of Ruby actually began in 1993 and inspired by many high-level programming languages like Perl, SmallTalk, Python, Lisp, etc. Ruby borrowed many high-level features from the mentioned languages. Moreover, Ruby is also inspired by Ada, Eiffel, etc language. The combined version of many languages made Ruby awesome. It made a new foot-print for the developers. Because Ruby has very simplified syntax yet very powerful. And that’s why it is called Ruby is “A Programmer’s Best Friend”.
The most remarkable features of ruby that made the language efficient and reliable:
Object-oriented: SmallTalk is a purely written object-oriented language. And Ruby is partially inspired by Smalltalk, and Ruby is also a pure and true object-oriented language. Every single value in ruby treated as an object.
Variable Scoping: Ruby is a very loosely typed language. You don’t have to declare any data type while declaring a variable. Another exciting feature of Ruby is, you don’t have to declare the variable scope as well. Using a very easy syntax, you can tell the ruby interpreter whether the variable local, global, instance or class variable.
Dynamics: Ruby is a very dynamic language as well. All kinds of variables are dynamically typed. Means, variables can hold any kind of objects and the value can be changed while executing the code. It is called duck typing. Ruby is very dynamic because like java or C programming, ruby is not a compiled language.
Web Programming: Ruby is the best choice for server-side scripting. Using ruby it is possible to write cgi script and rich web frameworks like rails. Many mainstream sites are entirely or partially written in ruby like Soundcloud, GitHub, etc.
Standard library: Ruby has many built-in classes, functions, and methods that really make your days easier. Like this one, using prime functions you can check easily whether a number is prime or not;
5.prime? #executes true or
6.prime? #executes false.
Uses of Ruby Programming
Ruby is a general-purpose and interpreted programming language. It is mostly used on server-side scripting. However, there are many uses of the Ruby programming language. Check out the post below.
10 Best Uses of Ruby Programming Language
What is next?
In this entire tutorial, we will use Linux Ubuntu as a ruby running environment. Sometimes we will use Windows. As Ruby is cross-platform, you can also use any flavor of operating system including Windows, macOS or any Linux distro for playing with ruby code.
In the next subsequent chapters, we will learn ruby from installation, running on different platforms, basic syntax, and every individual component of ruby programming. Let’s start!