Difference between revisions of "Constants - Variables - Data Types"
Line 6: | Line 6: | ||
*String is used for storing characters in word form. | *String is used for storing characters in word form. | ||
− | <syntaxhighlight lang="csharp" line>"hello world"</syntaxhighlight> | + | |
+ | <syntaxhighlight lang="csharp" line>"hello world"</syntaxhighlight> | ||
+ | |||
*Integer is used to store whole numbers (32 bit values). | *Integer is used to store whole numbers (32 bit values). | ||
− | <syntaxhighlight lang="csharp" line>457568368</syntaxhighlight> | + | |
+ | <syntaxhighlight lang="csharp" line>457568368</syntaxhighlight> | ||
+ | |||
*Double is used to store numbers where there are numbers before and after the decimal point. | *Double is used to store numbers where there are numbers before and after the decimal point. | ||
− | <syntaxhighlight lang="csharp" line>3.3</syntaxhighlight> | + | |
+ | <syntaxhighlight lang="csharp" line>3.3</syntaxhighlight> | ||
+ | |||
*decimal is used for numbers only after the decimal point. | *decimal is used for numbers only after the decimal point. | ||
− | <syntaxhighlight lang="csharp" line>.3</syntaxhighlight> | + | |
+ | <syntaxhighlight lang="csharp" line>.3</syntaxhighlight> | ||
+ | |||
*Character is used to store single letters. | *Character is used to store single letters. | ||
− | <syntaxhighlight lang="csharp" line>'A'</ syntaxhighlight> | + | |
+ | <syntaxhighlight lang="csharp" line>'A'</ syntaxhighlight> | ||
+ | |||
*Byte is used to store a byte( eight 1's or 0's). | *Byte is used to store a byte( eight 1's or 0's). | ||
− | <syntaxhighlight lang="csharp" line>00101101</syntaxhighlight> | + | |
+ | <syntaxhighlight lang="csharp" line>00101101</syntaxhighlight> | ||
+ | |||
*Float is used to store a set number of digits after a decimal place. | *Float is used to store a set number of digits after a decimal place. | ||
− | <syntaxhighlight lang="csharp" line>3.0000000000</syntaxhighlight> | + | |
+ | <syntaxhighlight lang="csharp" line>3.0000000000</syntaxhighlight> | ||
+ | |||
*Long integer is also used to store whole numbers (However these are 64 bit values). | *Long integer is also used to store whole numbers (However these are 64 bit values). | ||
+ | |||
<syntaxhighlight lang="csharp" line>7846354759340276482</syntaxhighlight> | <syntaxhighlight lang="csharp" line>7846354759340276482</syntaxhighlight> |
Revision as of 10:46, 15 December 2016
There are 9 types of data types. These include boolean, string, integer, double, decimal, character, byte, float and long.
- Boolean is a binary value, being either true or false.
1 bool test = true;
- String is used for storing characters in word form.
1 "hello world"
- Integer is used to store whole numbers (32 bit values).
1 457568368
- Double is used to store numbers where there are numbers before and after the decimal point.
1 3.3
- decimal is used for numbers only after the decimal point.
1 .3
- Character is used to store single letters.
1 'A'</ syntaxhighlight>
2
3 *Byte is used to store a byte( eight 1's or 0's).
4
5 <syntaxhighlight lang="csharp" line>00101101
- Float is used to store a set number of digits after a decimal place.
1 3.0000000000
- Long integer is also used to store whole numbers (However these are 64 bit values).
1 7846354759340276482