Arrays and hashes are indexed collections which are used to store a collection of objects and those stored objects are accessed via a key.
In case of arrays, the key is an integer while in case of hashes, the key is also an object. For example, in case of arrays, we can access the first element [...]
Archive for the 'Ruby' Category
Ruby Lesson 3: Arrays and Hashes
August 13, 2008Ruby Lesson 2: Some Basic Ruby Concepts
August 12, 2008In this section, we provide some basic concepts of Ruby.
Defining a Method (Function)
Notes on defining function:
No need to use semi-colon at the end of the statement since each statement are in a separate line.
Ruby comments start with #
Indentation makes code more pretty.
functions are defined with def and ended with end.
using parentheses with function parameters is [...]
Ruby Lesson 1: Ruby is an Object Oriented Language
August 12, 2008So, I will assume that ruby is installed (not a complex process). I will go directly to the programming concepts.
Ruby as Object-Oriented Language
Ruby is a genuine object-oriented language. Everything is an object. results of manipulation are also objects.
Why object-oriented? Because using this programming models forces the developer to look from the Real-World point [...]
Introduction
August 12, 2008In this series of blogs, I’m summarizing the very powerful programming language Ruby. I’ve selected this language after I discovered that it’s powerful enough for many purposes, including web development, scripting and other general-purposes. So, Let’s discover it.
[TECH NOTES] Learn Ruby (Part 1)
May 5, 2008Introduction
Ruby is a simple language !!
Ruby is Object Oriented
Everything is Ruby is Object-Oriented code, which reflects a real model from real world.
Example
In an online store, u may find many categories, so we define a class to represent each category
Class
A class is a combination of state and methods that use that state.
Once class is defined, we [...]