Skip to content

Instantly share code, notes, and snippets.

@alexthompson207
Last active October 13, 2020 23:29
Show Gist options
  • Save alexthompson207/098acffbf1c51bda6b8598637602048b to your computer and use it in GitHub Desktop.
Save alexthompson207/098acffbf1c51bda6b8598637602048b to your computer and use it in GitHub Desktop.
Alex Thompson-Beginners Guide to data types

My Beginners Guide to Data Types

A data type represents the kind of data that you can use in the programming language

Data Types

String

String data types are used to represent text. Can also use spaces, numbers, and special characters.

Examples:
  1. "Mountain biking is my favorite activity"
  2. "(307)-207-9080"
  3. "Alex Thompson"

Integers

Integers are a whole number (no fractions or decimals) that can positive, negative, or zero.

  • Examples:
  • 100000
  • -4
  • 0
  • ~Long Peak~

Array

Arrays are data structures that represent groups of things (usually the same data type).

  • Examples:
  • [1, 2, 4, 6, 10]
  • ["house1", "house2", "house3", "house4"]
  • [true, true, false, false]

Hash or objects

Hash or objects is a collection of key-value pairs.

  • Examples:
  1. {"meat department": 10, "dairy department": 3, "produce department": 20 }
  2. {"bottles": 2, "boxes": 10, "pens":100}

Here are some examples in javaScript of string, integer, array, and boolean data types respectively.

var mountain = "Mountains in Wyoming";
var number = 12;
var list = {"meat", "milk", "pizza", "cheese"};
var isItOpen = true;

Here's some poor images:

Data Types Image

incline-style for practice

Data Types 2

reference style for practice

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