Primitive
A primitive is a basic building block
What is a Primitive? π§±
A Primitive is a basic building block of data, the smallest lego brick, the simplest type of data.
Characters & Strings π¬
A Character is a single letter and can also be a single symbol, or a single number.
'a' '1' '?'
A String is a series of characters connected together.
"Hello World!" "jkh1?/5h51" "aaaaaaaaa"
Number β β
A Number is a unit apart of a mathematical system and subject to rules of addition, multiplication, etc.
Types of Numbers: integer, float, fixed, double, real, double precision, int, short, long, byte, etc... are commonly used data types.
Int = Whole Number = 42 π’
Float = Real Number = 3.14 π₯§
Long = Big Number = 2,147,483,647 π
Why are there so many types?: Storing numbers with the appropriate amount memory saves the computer from using extra resources.
Fraction = 1/3 = .3333333 βΎοΈ
π₯οΈThe fraction 1/3 would crash every computer ever built if stored as an infinite number because computers have limited spaceπ₯οΈ
Numbers are Not Equal to Strings or Characters π¨ββοΈ
A computer treats different types of data differently. The number 1 is not the same as the character 1.
π«Int "1" Not Equal Chr "1" π«
π«Chr "1" Not Equal Int "1" π«
π«Float "3.14" Not Equal String "3.14" π«
π«String "3.14" Not Equal Float "3.14" π«
Boolean & Binary π π
A Boolean has one of two possible values: True or False.
βΆοΈ music player (play, pause)βΈοΈ
π‘light switch (on, off)π‘
π°water faucet (open, closed)π°
Binary is a number built from two possible values: 1 or 0.
1
0
1001001
1111
π₯οΈ A computer converts all information into 1's and 0's stores/manipulates that data and spits back what you see. π₯οΈ
Reference (Pointer)ππ
A Reference is where a piece of data is in memory.
I want the data at address 2
I use the reference number 2
I get the data I want 'b'
A Reference can be thought of as a physical address, a bank account number, a bitcoin wallet, or venmo/cashapp/zelle address.
Citing original sources in a research paper π
Paying a friend back for pizza using venmo π
πΈ peer-to-peer mobile payment apps are good examples because you dont know whats in someone elses account but you do know how to request money or send money to that accountπΈ
Story Time: Ancient Atomic TheoryβοΈ
The inventor of atomic theory, Democritus, a Greek philosopherπ€who lived in 500 B.C. He imagined continuously cutting an item in half. if he cut a rock in two, he knew the halves would have the same properties as the whole. If he continued cutting forever, he hypothesized a limit where his rock was uncuttable. The piece was as small as it could possible be (indivisible). These uncuttable pieces he called "atomos", the Greek word for indivisible.
"Nothing exists except atoms and empty space; everything else is opinion." Democritus
Last updated