Snippets
Snippets
<h2>Data Types</h2>
<p>
Computer programs handle and process data, and those data usually come in the form
of <strong class="keyword">numbers</strong>, <strong
class="keyword">strings</strong>, <strong class="keyword">booleans</strong>, and
<strong class="keyword">collections</strong>, all of which may be stored in
variables.
</p>
<ul>
<li>
<p>
Numbers: The basis for all arithmetic, programmers use numbers to perform
innumerable tasks, and not just limited to calculations. On the last page, you may
have noticed that the C# example used the keywords "int" and "float" in order to
declare the numeric variables. "int" stands for integer in this case, and float
refers to "floating-point number" which are used in order to support numbers
between integers, i.e. fractions.
</p>
<p class="note">
Numbers can be broken down into different types of numbers like integers,
floating point numbers, and double precision floating point numbers (big numbers
which can be represented with decimals), to name a few. Some languages, like C# and
C++, require the programmer to distinguish what type of number is being used.
</p>
</li>
<li>
Strings: strings are a series of literal characters. Programmers typically
use strings to create messages to be read by the user, but is certainly not limited
to that purpose. We saw a string being used in the earlier PHP example printing
"Hello, World."
</li>
<li>
Booleans: The only two possible values being "true" or "false," booleans are
used when the program needs to ask a question. We will learn more about booleans
when we discuss conditions and logic in the coming pages.
</li>
<li>
Collections: collections store multiple values of the above data types. We
will learn more about collections in the coming pages.
</li>
</ul>
<p>
Programs can become very large and sophisticated, but ultimately they are simply
processing the above data types in instructions that the programmer wrote. However,
programming typically involves more than just statements and variables.
Now that we have learned the core ingredients in a statement, let's move on to look
at how we can organize our code statements to extend our capabilities as
programmers.
</p>
</section>