Ruby is a popular object-oriented programming language. You can use Ruby to write anything from simple scripts to complex web applications. Open your favorite text editor and follow these tutorials to start exploring Ruby.
In this tutorial, you’ll set up a Ruby programming environment on your local macOS machine using Homebrew—a free and open-source package manager for macOS—and you’ll test your environment out by writing a simple Ruby program.
This tutorial will go over how to set up a Ruby programming environment on your local Windows 10 machine using the command line. You’ll configure Bash on Windows, and then use the Ruby Version Manager—better known as RVM, a software platform built to manage multiple Ruby installations—to install the latest version of Ruby and its prerequisites. Then you’ll test your environment out by writing a simple Ruby program.
In this tutorial, you’ll set up a Ruby programming environment on your local Linux machine via the command line. Then you’ll test your environment out by writing a simple Ruby program. This tutorial explicitly covers the installation procedures for Ubuntu 16.04, but the general principles should apply to any Debian-based distribution.
The “Hello, World!” program is a classic and time-honored tradition in computer programming. It’s a simple and complete first program for beginners, and it’s a good way to make sure your environment is properly configured. This tutorial will walk you through creating this program in Ruby.
IRB, short for Interactive Ruby, is a REPL (read-eval-print loop) which serves as a quick way to explore the Ruby programming language and try out code without creating a file. In this tutorial, you’ll use IRB to run some code, inspect its output, bring in external libraries, and customize your IRB session.
Comments are lines in computer programs that are ignored by compilers and interpreters. You can use comments to make your programs easier for other programmers to understand by providing more context or explanation what each part of a program is doing. In this tutorial, we will look at how to use comments in Ruby programs to leave notes, as well as how to use them as a debugging tool.
In this tutorial, you’ll learn about the most important data types native to Ruby: integers, floats, strings, symbols, arrays, and hashes. This is not an exhaustive investigation of data types, but it will help you become familiar with the options you have available to you in your programs.
A string is a sequence of one or more characters that may consist of letters, numbers, or symbols. In this tutorial, you’ll learn how to work with strings in Ruby. You’ll create strings, display them on the screen, store them in variables, join multiple strings together, and learn how to handle special characters such as newlines, apostrophes, and double quotes.
Ruby strings have many built-in methods that make it easy to modify and manipulate text, a common task in many programs. In this tutorial, you’ll use string methods to determine the length of a string, index and split strings to extract substrings, add and remove whitespace and other characters, change the case of characters in strings, and find and replace text. When you’re done, you’ll be able to incorporate these methods into your own programs.
An array is a data structure that represents a list of values, called elements. Arrays let you store multiple values in a single variable. This can condense and organize your code, making it more readable and maintainable. In this tutorial, you’ll create arrays, access the values they contain, add, modify, and remove elements in an array, and iterate through the elements in an array to solve more complex problems.
Arrays let you represent lists of data in your programs. Once you have data in an array, you can sort it, remove duplicates, reverse its order, extract sections of the array, or search through arrays for specific data. You can also convert an array to a string, transform one array of data into another, and roll up an array into a single value. In this tutorial, you’ll explore some of the most practical methods Ruby provides for working with data stored in arrays.
Ruby provides several methods for converting values from one data type to another. In this tutorial, you’ll convert strings to numbers, objects to strings, strings to arrays, and convert between strings and symbols.