Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Siebel eScript Language Overview > Data Types in Siebel eScript > Primitive Data Types in Siebel eScriptVariables that have primitive data types pass their data by value. If a parameter is passed by value, the variable used for that parameter retains its value when the subroutine or function returns to the routine that called it (the caller). The following fragment illustrates: var a = "abc"; After After the function The primitive data types are number, Boolean, and string. NumberThe number data type includes integers and floating-point numbers, which can be represented in one of several ways. NOTE: Numbers that contain characters other than a decimal point, except in hexadecimal and scientific notation, are treated as string values. For example, eScript treats the number 100,000 (notice the comma) as a string. IntegerIntegers are whole numbers. Integer constants and literals can be expressed in decimal, hexadecimal, or octal notation. Decimal constants and literals are expressed by using the decimal representation. See the following two sections to learn how to express hexadecimal and octal integers. HexadecimalHexadecimal notation uses base 16 digits from the sets of 0-9 and A-F or a-f. These digits are preceded by 0x. Case sensitivity does not apply to hexadecimal notation in Siebel eScript. Examples are: 0x1, 0x01, 0x100, 0x1F, 0x1f, 0xABCD 1, 1, 256, 31, 31, 43981 OctalOctal notation uses base 8 digits from the set of 0-7. These digits are preceded by a zero. Examples are: Floating PointFloating-point numbers are numbers with fractional parts that are indicated by decimal notation, such as 10.33. Floating-point numbers are often referred to as floats. DecimalDecimal floats use the same digits as decimal integers but use a period to indicate a fractional part. Examples are: 0.32, 1.44, 99.44 ScientificScientists often use scientific notation to express very large or small numbers. It uses the decimal digits in conjunction with exponential notation, represented by 4.087e2, 4.087E2, 4.087e+2, 4.087E-2 408.7, 408.7, 408.7, 0.04087 BooleanBoolean variables evaluate to either false or true. Because Siebel eScript automatically converts values when appropriate, when a Boolean variable is used in a numeric context, its value is converted to 0 if it is false, or 1 if it is true. A script is more precise when it uses the actual Siebel eScript values, false and true, but it works using the concepts of zero and nonzero. StringA string is a series of characters linked together. A string is written using a pair of either double or single quotation marks, for example: "I am a string" The string Siebel eScript automatically converts strings to numbers and numbers to strings, depending on the context. If a number is used in a string context, it is converted to a string. If a string is used in a number context, it is converted to a numeric value. Automatic type conversion is discussed more fully in Automatic Type Conversion in Siebel eScript. Although strings are classified as a primitive data type, they are actually a hybrid type that shares characteristics of primitive and composite data types. A string may be thought of as an array (a composite data type) of characters, each element of which contains one character. For an explanation of arrays, read Array. |
Siebel eScript Language Reference |