Int: Difference between revisions
Mr. MacKenty (talk | contribs) (Created page with "right|frame|Programming basics<ref>http://www.flaticon.com/</ref> Int (signed integers): They are often called just integers or ints, are positive or nega...") |
Mr. MacKenty (talk | contribs) No edit summary |
||
Line 21: | Line 21: | ||
In Python: | In Python: | ||
<syntaxhighlight lang="python3"> | <syntaxhighlight lang="python3"> | ||
a = 1234; | # decimal number: | ||
a = -123; | a = 1234; | ||
# a negative number: | |||
a = -123; | |||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 06:46, 6 August 2017
Int (signed integers): They are often called just integers or ints, are positive or negative whole numbers with no decimal point.[2]
Difference between an int and a float[edit]
Integers and floats are two different kinds of numerical data. An integer (more commonly called an int) is a number without a decimal point. A float is a floating-point number, which means it is a number that has a decimal place. Floats are used when more precision is needed.[3]
Example[edit]
In PHP: You will remember PHP isn't a strictly typed language (although it can be set to be).
<?php
$a = 1234; // decimal number
$a = -123; // a negative number
?>
In Python:
# decimal number:
a = 1234;
# a negative number:
a = -123;
In Javascript:
Do you understand this?[edit]
Standards[edit]
- Define the terms: variable, constant, operator, object.