Skip to Content
Learn
Introduction to Ruby
Data Types: Numbers, Strings, Booleans

In Ruby, your information (or data) can come in different types. There are three data types in Ruby that we’re interested in right now: Numeric (any number), Boolean (which can be true or false), and String (words or phrases like "I'm learning Ruby!").

Computer programs exist to quickly analyze and manipulate data. For that reason, it’s important for us to understand the different data types that we can use in our programs.

Reminder: never use quotation marks (‘ or “) with booleans, or Ruby will think you’re talking about a string (a word or phrase) instead of a value that can be true or false. It’s also important to remember that Ruby is case-sensitive (it cares about capitalization).

Instructions

1.

Set the following variables to the corresponding values:

  • my_num to the value 25
  • my_boolean to the value true (note the capitalization!)
  • my_string to the value "Ruby"
Folder Icon

Take this course for free

Already have an account?