Getting Started With Ruby 08-29-2015, 12:06 PM
#1
Ruby
A PROGRAMMER'S BEST FRIEND
A PROGRAMMER'S BEST FRIEND
Firstly; What Is Ruby?
Ruby is...
A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. (https://www.ruby-lang.org/en/) Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto. It was influenced primarily by Perl, Smalltalk, Eiffel, and Lisp.
Ruby is also cross-platform meaning it can run on any OS that has the runtime installed. You can download Ruby here: https://www.ruby-lang.org/en/downloads/ - The current stable version is 2.2.3 at the time of this post.
Ways of Installing Ruby
- On Linux/UNIX, you can use the package management system of your distribution or third-party tools (rbenv and RVM).
- On OS X machines, you can use third-party tools (rbenv and RVM).
- On Windows machines, you can use RubyInstaller.
How Can I Get Started?
Firstly, you will need to download Ruby on your system before you can start developing. Alternatively you can use an online IDE to run your programs.
Ruby file extensions are usually; .rb, .rbw. If you are using a text editor to write your scripts then you will need to save the file under one of these extensions. Once you have installed Ruby on your system you can start by entering "irb" into your terminal.
![[Image: VN52ykv.png]](http://i.imgur.com/VN52ykv.png)
The interactive terminal help your test your Ruby code on the fly, you simply type what you want and the IRB will execute the code for you. For example you can do quick maths (1+ 4, 4 * 5, 3 / 4) you can add variables and arrays (new_array = [1, 2, 3]) and so on.
![[Image: Szno9ha.png]](http://i.imgur.com/Szno9ha.png)
Try It For Yourself!
Okay, now that you know how to install it and run irb, it's time to create a script using a text editor or an IDE whichever one you prefer.
Open up your favourite text editor or, the one I am using is RubyMine.
Enter the following;
Code:
puts 'Hello, World!'Then save it as hello.rb and run it! Your Ruby files will all have the .rb file extension. To run the hello.rb Ruby script, run the command ruby hello.rb Now that wasn't so hard, compared to C++, that is a lot less code.
Code:
// THIS IS C++ NOT RUBY.
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}Learning Ruby & Resources
Learning Ruby:
Ruby | Codecademy
Try Ruby: learn the basics
Learn Code The Hard Way
Ruby in Twenty Minutes
IDE's:
Aptana
RubyMine
someone with no history is nothing but suspicious.
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)



























