Page 160 - DCAP512_WAP_AND_WML
P. 160

WAP & WML




                    Notes                        WMLBrowser setVar (“answer”, “Yes”);
                                          }
                                          extern function MyFunct() {
                                                 return “Yes”;

                                          }

                                   11.3.1 Working with Variables

                                   Variables for WML Script functions are:
                                      weakly typed

                                      must be declared
                                      have a local scope
                                      must be one of these data types
                                           Boolean
                                           Integer

                                           Invalid
                                           Float
                                           String
                                   Data Types

                                   Table 11.2 represents the data types and their description.
                                                                     Table  11.2

                                      Data Type   Description
                                      Boolean    Must be either True or False
                                      Integer    Integer from 2,147,483,648 to 2,147,483,647. Precede hex literals with “ox” or “oX”.
                                                 Precede octal literals with”0”
                                      Invalid    Literal  variable.  Indicates  invalid  values  that  may  result  from  a  floating-point
                                                 overflow
                                      Float      Floating point decimal numbers from +/- 1.17549435E-38 to +/-3.02823476E+38.
                                                 Specify literal exponents with “e” or “E”.
                                      String     Character string. Enclosed by single quotes or double quotes.

                                   Variable: Declaring and Setting

                                          var MyVar;
                                          Setting a variable’s value
                                          MyVar=”Welcome”;

                                          MyVar=”6.5"
                                   Other possibilities
                                      pre-increment




          154                               LOVELY PROFESSIONAL UNIVERSITY
   155   156   157   158   159   160   161   162   163   164   165