Development

A Ruby Primer, Part 14 -- Logical operators

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Logic in Ruby Ruby provides the standard logic operators of ‘and’, ‘or’, and ‘not’ through the logical operators ‘and’, ‘or’, and ‘not’ (or if you prefer C-style, ‘&&‘, ‘||’, and ‘!’), respectively. The logical operator ‘and’ is true if, and only if, both relational (comparison) operators are true.

A Ruby Primer, Part 13 -- Relational operators

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Comparisons in Ruby As discussed in Part 7 of this primer, Ruby provides the standard boolean values of ‘true’ and ‘false, and the standard relational (comparison) operations of is equal to, is not equal to, is greater than, is less than, is greater than or equal to, is less than or equal to through the relational operators ‘==’, ‘!=’, ‘>’, ‘<‘, ‘>=’, and ‘<=‘, respectively.

A Ruby Primer, Part 12 -- Arithmetic operators

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Arithmetic in Ruby As discussed in Part 6 of this primer, Ruby provides the standard arithmetic operations of addition, subtraction, multiplication, division, remainder (modulo), and exponention through the binary operators ‘+’, ‘-’, ‘*’, ‘/’, ‘%’, ‘**’, respectively.

A Ruby Primer, Part 10 -- Hashes

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Hash: A hash is an associative collection of unique keys and their values. Ruby documentation Hashes in Ruby Ruby allows us to create dictionary-like objects, called hashes, which are associative collections of unique key-value pairs.

A Ruby Primer, Part 11 -- Variables and constants

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Variable: A variable is a symbolic name associated with some value, whether known or unknown. Wikipedia article) Constant: A constant is a symbolic name associated with some known value, that is not intended to change.

A Ruby Primer, Part 9 -- Arrays

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Array: An array is an ordered, indexed collection of objects. Ruby documentation Arrays in Ruby Ruby allows us to create ordered (but not necessarily sequenced) collections of objects, called arrays. An array contains some number of elements (objects) which are indexed using integers.

A Ruby Primer: Exercise 1 -- A random number min-max detector

In this exercise, you will create a Ruby script to detect the minimum and maximum values from a collection of randomly generated numbers. Specification File Name: random-min-max.rb Input: Several numbers representing the minimum possible randomly generated number, the maximum possible randomly generated number, and the number of random numbers to generate. Output: Several strings containing various prompts, the results of the minimum and maximum detected values from the randomly generated numbers, and all of the randomly generated numbers for verification purposes.

A Ruby Primer, Part 6 -- Numbers

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Numeric: A Ruby class representing a numeric data type. Ruby documentation Integer: A Ruby class representing whole number data types. Ruby documentation Float: A Ruby class representing floating point number data types. Ruby documentation Binary: A base-2 number system.

A Ruby Primer, Part 7 -- Booleans

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Boolean: A boolean is a data type intended to represent logical truth values. Wikipedia article Comparison: A comparison is an operation that is used to test the inequality of values. Wikipedia article) Booleans in Ruby Ruby provides three boolean literals that we can use when making comparisons or in conditional expressions: true, false, and nil.

A Ruby Primer, Part 8 -- Ranges

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Range: A range is a sequenced interval of data. Ruby documentation Ranges in Ruby Ruby allows us to create sequenced intervals of data (e.g. the integers 1 through 10) as a range object. We can create a range of any type of object in Ruby, as well as create our own custom ranges.

A Ruby Primer, Part 5 -- Strings

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Data Type: A data type is a classification identifying a type of data. Wikipedia article Literal: A literal creates objects in Ruby. Ruby documentation Class: A class is a template for creating objects, and for providing initial values for state (member variables, or properties) and implementations of behavior (member fuctions, or methods).

A Ruby Primer, Part 4 -- Outputting and inputting data

If you have not yet set up your development environment, please refer to Part 1 of this primer. If you are unfamiliar with using the Ruby Interactive Shell, please refer to Part 3 of this primer. Terms Method: A method is a member function (collection of code statements or expressions) associated with an object, and which has access to its data and its member variables. Method Signature: A method signature is a specification for how to use a method and is given in the format method_name([arguments]) -> return_value, where [arguments] is a potentially empty array (collection) of objects to be given as parameters for the method.

A Ruby Primer: Exercise 1 -- A simple command line calculator

In this exercise, you will create a Ruby script for a simple command line calculator. Specification File Name: simple-calculator.rb Input: Several strings containing your name, the user’s name, integers, and floats. Output: Several strings containing various prompts and the results of various arithmetic calculations. Methods Used: puts, print, gets, to_i, to_f, to_s (for floats) Sample Output Welcome to the Simple Calculator by Disciples of Code Please enter your name: Clark Kent Hello, Clark Kent Let's try some addition!

A Ruby Primer, Part 3 -- Ruby scripts

If you have not yet set up your development environment, please refer to Part 1 of this primer. Scripts? While using the Ruby Interactive Shell (IRB) to evaluate your Ruby code can be very useful for learning, debugging, and executing short statements or expressions, to create larger (and persistent) Ruby programs, you will need to store all of your Ruby code in scripts. A script is simply a plain-text file that contains your code.

A Ruby Primer, Part 2 -- Using the Ruby interactive shell IRB

If you have not yet set up your development environment, please refer to Part 1 of this primer. Using IRB The Ruby Interactive Shell, or IRB, provides a command line with which we can immediately evaluate a Ruby statement or expression. To load IRB, open a Terminal window (OS X or Linux) or a Command Prompt (Windows), and execute the following command. ``` bash Loading IRB $ irb You should now be inside IRB, and should have a command prompt similar to the following.

A Ruby Primer, Part 1 -- Setting up your development environment

The first step to learning Ruby (or any programming language) is to set up your development environment, so let’s dive right in. The simplest method is to use a free, online development environment, such as those provided by Koding.com. If you have already signed up for a GitHub account (which is highly recommended for source control and for sharing your code), you can sign up for Koding.com using your GitHub account credentials.

Disciples of Code: Decoded, Part 1 -- Code

I say ‘code’, you say ‘program’. He says ‘script’, she says ‘app’. Does it matter? Putting aside the many technical definitions and nuances, in practice these terms are nearly synonymous — at least to a general audience. What we’re really talking about is machine language, or a way of communicating with machines (e.g., computers) by combining a set of symbols, words, and statements according to certain predefined rules. Communication is more than just words, communication is architecture, because of course it is quite obvious that a house which would be built without that will, that desire to communicate, would not look the way your house looks today.

Disciples of Code: Decoded, Part 2 -- Decoding the why

You can launch your favorite web browser and do an Internet search, and find any number of individuals and organizations offering reason after reason that learning to code is important. You can most likely find an equal number offering an opposing opinion. Of course, like with nearly all subjects of grand relevance, what this really means is that the ‘Why’ to the importance of coding, is up to you. And with any endeavor, the end result and polished nature of the output is nowhere near as significant as the attitude and approach of the individual undertaking the task.

Disciples of Code: Decoded, Part 3 -- Discipline as disciples

So you are ready to begin your journey and learn to code, but you don’t know where to begin. Of course, information is free, for those willing to find it, but not all information is as valuable or worthwhile when you are just starting out. At this point, you can’t tell bad code from good. You have no idea whether you should start out by thumbing through some massive tome of seemingly arcane jargon in an attempt to glean some tidbit of understanding, or simply fire up your trusty Internet search engine and dive in head-first.