Zoonk icon

Type system

set of rules that assign a property called type to various constructs a computer program consists of, such as variables, expressions, functions or modules

Share something about Type system


Chapters have lessons for teaching a topic. Help more people learn about Type system. Create the first chapter.

Numbers in Ruby

There are a few types of numbers available in Ruby. Let's see some examples: fruits = 10 lottery_prize = 42000000 price = 4.20 expression = 1 + 2i fraction = Rational(1, 3) precise_price = BigDecimal(

Data types in Ruby

When we're creating a variable in Ruby, we're also assigning a data type to it. For example, when we write something like this: car = "Tesla" We're actually telling our program to create a varia

Hashes in Ruby

If you're coming from other programming languages, you might know hashes as a "dictionary" or an "object". Like arrays, can also store multiple items. But, different from arrays, you can access them

Arrays in Ruby

We've already learned about many data types such as strings, numbers, booleans, and symbols. Using , we can store many of those items in the same variable: cool_websites = ["zoonk", "khan academy"

Symbols in Ruby

Symbols are similar to strings but they are identifiers rather than data. They're different than strings, though, as you cannot change them. For example, if you call 10 times, it will actually crea

Strings in Ruby

Strings are text representations. You can use them to name things. For example: app_name = "Zoonk" scientist = "Albert Einstein" You can also join two different strings by using the sign: firs

Booleans and Nil in Ruby

In programming, a is like a toggle value which can be either or . For example, let's say you want to check a menu status (whether it's open or closed). You could create a boolean variable for that: