WMLScript Reference

[Cover] [Previous Section] [Next Section] [Index]

Current chapter: Chapter 3 - Variables and Data Types
Section 14 out of 34 total sections , Section 3 out of 3 sections in this chapter


Data Types

Data types define the type of data the variable will hold. Examples of data types are:

var flag = true  
var number = 12  
var temperature = 37.7  
var number = "XII"  
var except = invalid  

WMLScript 1.1 supports data types internally only. You do not have to specify the variable type, and any variable can contain any type of data at any given time. A fifth data type, invalid, is used when a data type needs to be differentiated from the other internal data types.

This section describes the following data types, all of which are supported by WMLScript 1.1:



Integer Size


Definition

The range supported by WMLScript 1.1 for integer values.


Comments

The supported value range is -2147483648 to 2147483647. You can use Lang library functions to get these values during run time.

Lang.maxInt () 

Maximum representable integer value. 

Lang.minInt () 

Minimum representable integer value. 



Floating-Point Size


Definition

The minimum and maximum values and the precision for floating-point values.


Comments

The maximum supported value is 3.40282347E+38.

The minimum positive nonzero value (at least the normalized precision must be supported): 1.17549435E-38 or smaller.

You can use the Float library functions to get these values during run time:

Float.maxFloat ()  

Maximum representable floating-point value supported. 

Float.minFloat ()  

Minimum representable floating-point value supported. 

The special floating-point number types are handled by using the following rules:



String Values


Definition

Temporary combinations of letters, digits, or special characters.


Comments

You can use string literals to initialize string variables.

You can manipulate string values with WMLScript 1.1 operators and the functions specified in the standard String library.


Examples

var msg = "Hello";  
var len = String.length(msg);  
msg = msg + ' Worlds!';  


Boolean Values


Comments

You can use boolean values:

Boolean values can be a literal or the result of a logical expression evaluation.


Examples

var truth = true;  
var lie = !true;  

[Cover] [Previous Section] [Next Section] [Index]


Part Number DKWS-41-002, UP.SDK Release 4.1, December 2000

Copyright © 1994-2000 Openwave Systems Inc. All rights reserved.
Please send comments and questions to sdk-doc-comments@openwave.com.