Skip to content

Instantly share code, notes, and snippets.

@kip-west
Last active March 19, 2020 17:38
Show Gist options
  • Save kip-west/051ce22ac86d9e58ac0041024caa3698 to your computer and use it in GitHub Desktop.
Save kip-west/051ce22ac86d9e58ac0041024caa3698 to your computer and use it in GitHub Desktop.
Beginners Guide to Data Types

Guide to Data Types

1. String

  • Use: used to represent text data
  • Denoted by ' ' or " " marks.
  • example: "Peach" or "(303)555-5555" or "colorless green ideas sleep furiously"

2. Integer

  • Use: used to represent whole number data
  • Can be +, -, or 0 & manipulated mathematically
  • example: 1 or 1,375

3. Float

  • Use: used to represent decimal point/fractional data
  • Can be + or - & manipulated mathematically
  • example: 3.141592 or -0.00001

4. Boolean

  • Use: either True or False
  • You can think of this like a light switch
// Useful symbols when working with type of data include: && || and ==
  • example: True or False

5. Array

  • Use: data structure that represents a group of things
  • Typically, data within an array are all the same type
  • example: ["The Shining", "It", "Pet Sematary", "Dr. Sleep"] or [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]

6. Hash/Object

  • Use: used to represent a key-value pair of data.
  • Similar to an array, except we are pairing data together
  • example: {"March": 58, "April": 65, "May": 73}

alt text

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