Skip to content

Instantly share code, notes, and snippets.

@bruce-gordon
Last active July 18, 2020 16:39
Show Gist options
  • Save bruce-gordon/3e1403ecef68483b1189d2b2b279f051 to your computer and use it in GitHub Desktop.
Save bruce-gordon/3e1403ecef68483b1189d2b2b279f051 to your computer and use it in GitHub Desktop.

Beginners Guide to data types

Data Type Diagram

Introduction

A data type is the kind of data that can be used in a language, and also describes the way that we represent information, or data. Data types include:

  1. String - Used to represent text, in quotations
  2. Number
  • Integer - A whole number which can be positive, negative, or zero
  • Float - A number with a decimal, which can be positive or negative
  1. Boolean - A piece of data that is only represented as true or fasle
  2. Array - A group of multiple pieces of the same type of data, contained in brackets, and separated by commas.

Basic Examples

String

var first_pizza = "New York Style";

var second_pizza = "Chicago Style";

Number

var height = 9;

var width = 7.2;

Boolean

var happy = true;

var open = false;

Array

var class_mates = ["Soraya", "Duncan", "Miguel"];
var distances = [23, 17, 18, 45, 81];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment