Outline the
Benefits of Having a Variety of Data Types
Boolean:
Boolean is a part of a larger group of algebra that is used
to making a T/F (True/False) statement. True will be written as the number 1,
whereas false will be written as the number 2. Boolean can be written in both
algorithms and coding. Boolean was developed by the English mathematician and
computer pioneer George Boole (Hence the name Boolean). A boolean consists of
operators such as and, or, not and xor. Booleans are often used in programming
and today in internet search engines. Boolean expressions are expressions that
result in the value of either true or false.
As mentioned above, a user can use Boolean searches to help
locate more exact matches in internet searches.
String:
String is very useful for programmers because it can hold
many letters and numbers without having to use the data type char. In
programming, to use string you will have to use quotation marks to emphasise
that it’s a quote and not a command. An example of string is in JavaScript: var
carname = “Mercedes”. String is a contiguous sequence of symbols or values,
such as a character string or a binary digit string.
Char:
Char is
another data type that is useful to programmers. Char is used as a reserved keyword
in a number of programming languages, such as C, C++, C# and Java. It is short
for character, you would use char when you only need to hold one single
character but when you don’t need string. In addition, other languages that do
not have char as a data type may use the abbreviation for certain methods that
are used with string values. For example, JavaScript has methods such as
charAt() and charCodeAt() that return values relate to the calling string. The
charAt() method, for instance, returns a string containing one character, which
is the character at the location given as the framework to the function. .
Integer:
Integer is one of the data types that a programmer will need
whilst programming. An integer is a whole number, so no decimal places, just
like in maths. Integers are useful for programmers when coding because some of
their program will be in numbers. The use of integers as variables supports
programming in various ways. For instance, a common strategy is to create an
integer variable and store some value in it that will influence calculations
made within the program. Examples include things like counters and calendars.
Float:
Float, also known as floating point is numbers that have
decimals in them, such as 4.20 or 13.37, just as long as they have a decimal
point in them. Float is similar to integer but float has decimals whereas
integers don’t. There are also no fixed numbers before and after the decimal
point. A float has numbers before and after the decimal place. Programmers will
use the term float before the name of a variable. A second line of code can declare
a value for the float variable by using the name of the variable, adding an equal’s
sign and following that with the value.
The float’s variable is often used to include currency values
in a computer program, such as US Dollars or Great British Pound Sterling.
Floats generally use the same operators as integers in the same ways. The
addition, subtraction, multiplication and division of these variables is fairly
straight forward in most cases.
Date and Time:
Date and time is mainly used to store dates on a program,
this could be like a calendar. On a calendar you can also set reminders or
alarms to give you a message at a certain time. This can be about anything,
whether to do your homework or go out with some friends. Date and time is
important while coding a program because if you are running a program and it doesn’t
have the correct date or time, it might not work properly.
No comments:
Post a Comment