Heads up! To view this whole video, sign in with your Treehouse account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Hello Computer Science!
You have completed Hello Computer Science!
Preview
An introduction to several data types you may encounter in your programming journey.
Definitions
- Text - data stored as a combination of letters, numbers, and symbols
- Numeric Data - whole, floating-point, and negative numbers that can perform mathematical operations
- Boolean - data that represents the truth value (true or false) stored as a bit
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Welcome.
0:00
In this video, we will introduce you to
several data types you may encounter in
0:01
your programming journey.
0:05
Consider the cabinets in your kitchen.
0:08
When I was growing up, the cabinet
next to our refrigerator was only for
0:11
drinking glasses.
0:15
The one above the countertop was for
canned foods.
0:16
The cabinet under the sink was for
cleaning supplies.
0:20
Now, you would never think to store
a drinking glass under the sink.
0:24
And I learned very quickly not to put
the green beans in the cabinet next to
0:28
the fridge.
0:31
Think of these kitchen
cabinets as data types.
0:34
Each data type is designated to
store one specific type of data.
0:36
If you break the rule, well,
you may get in trouble.
0:41
Some programming languages allow
you to store data without first
0:45
identifying its type, like Python.
0:49
Some languages allow the data's
type to change throughout the code,
0:51
such as JavaScript.
0:56
Other languages force the programmer to
identify the data's type before using it.
0:58
I'm talking about you Java.
1:03
There are so
many different data types, and
1:04
each programming language has its
own rules on how to use them.
1:07
Regardless of the language,
1:12
you are likely to encounter
one of these three data types.
1:14
The first is text.
1:18
It's a combination of letters,
numbers and symbols.
1:20
For example,
you can store my name, Richard,
1:24
my hometown, Roanoke, Virginia,
or a complete sentence,
1:29
I can be reached at (540) 555-1234.
1:35
Next is numeric data.
1:41
The advantage of numeric data is that
I can perform mathematical operations.
1:43
I can store whole numbers,
the number of bones in the human body, 206
1:50
population of a city 102,345.
1:57
Numbers with a decimal point,
Pi rounded to 4 decimal places, 3.1416
2:02
ounces of water in a liter, 33.8.
2:09
And even negative numbers,
strokes under par in a golf tournament, -16
2:15
absolute zero in Celsius, -273.15.
2:21
Finally, I can store Boolean values.
2:26
A Boolean represents a truth
value stored as a bit.
2:30
Remember that a bit can only be one
of two values, true or false, 1 or 0.
2:34
1 means true, 0 means false.
2:41
Think of a light switch as on or off, or
the answer to a question as yes or no.
2:45
Is the Nile River the longest
river in the world?
2:52
Are you over 25 years of age?
2:55
Is today Friday?
2:58
As you write code, you determine how
to store and use data in your program.
3:01
Don't worry, that's a discussion for
another time.
3:05
In the next video, I give you a brief
introduction to programming, stay tuned.
3:08
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up