Skip to content

Instantly share code, notes, and snippets.

@devHaitham481
Last active June 2, 2020 03:06
Show Gist options
  • Save devHaitham481/92fc26b79315f5e52d95e018aa8c9c7e to your computer and use it in GitHub Desktop.
Save devHaitham481/92fc26b79315f5e52d95e018aa8c9c7e to your computer and use it in GitHub Desktop.

Beginner's Guide to Datatypes

Datatypes in Ruby

so far, Ruby seems to handle datatypes in a very smooth way. what I mean by that is that unlike other languages like C++ where the datatype has to be declared prior to even thinking about initializing it, Ruby knows what datatype to assign a variable from the variable's content itself. like for example if we were to declare a variable x like this:

x = "Hello World!"

Ruby would automatically assign the variable x the datatype of String

  • Now, Ruby has many datatypes of which we can mention the following:
  1. Numbers
  2. Booleans
  3. Strings
  4. Hashes

A brief demonstration of the above datatypes would be like this :

x = 3; 
y = True/False;
z = "Hello World!"
c = {"Mod5" : "Sara & Michael", "Mod6" : "Haitham & John"}

This is an image

Inline-style: alt text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment