An int is an integer—a signed, whole-number, numeric value.
Integers are number values which may be the result of a mathematical expression. See Expressions, Operators.
In the context of a programming language, there are several different types of numbers which break down, roughly, into integers (numbers without a decimal point) and floating points (numbers with a decimal point). Because each device provides different numerical types and/or stores them differently, many computer languages use the local number types and leave the details up to the programmer. Other computer languages provide their own number types and map them to the device types so the programmer can write the same numeric code for all devices.
In the case of UJML, an int is a primitive data type that is stored by value. It supports only positive and negative integral values, no fractions or decimal points are allowed. In UJML, an int is stored as a signed 32-bit two's complement value ranging from -2,147,483,648 to 2,147,483,647 regardless of the device capability.
Integer literals are numbers without any punctuation, or hexadecimal values using the characters '0x' followed by the hexadecimal number. For example, to set a variable to the maximum int value, you could use the statement 'i = 2147483647;' or the statement 'i = 0x7FFFFFFF;'. See Literals and Constants.
The following example shows how to declare an int variable. It is part of the assignment.ujml sample.
<var name="mIntVar" type="int"/>
The following example shows how to set the variable declared above to a numeric literal and then uses it in a mathematical expression. It is part of the assignment.ujml sample.
mIntVar = 512; mIntVar = 512 * 2;
The following example shows how to set the variable declared above to the result of a function call. It is part of the assignment.ujml sample.
mStringVar = "-1024"; mIntVar = _string_to_int(mStringVar);
|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|