Page 162 - DCAP512_WAP_AND_WML
P. 162

WAP & WML




                    Notes          11.3.2  Operators

                                   Table 11.3 shows the four categories of operators used in WML Script.

                                                                     Table  11.3
                                                     Category           Operators
                                                     Assignment         =
                                                     Arithmetic         +, -, /, *, div, %
                                                     Comparison         ==, !=, <, >, <=, >=
                                                     Logical            &&, ||, !

                                   Arrays

                                   WMLScript does not support arrays as such. However,  the standard String library supports
                                   functions by which array-like behavior can be implemented using strings. A string can contain
                                   elements separated by a specified separator. For this purpose, the String library contains functions
                                   which allow you to create and manage string arrays. The following is an example of an array
                                   operator:
                                   function dummy() {
                                          var str = “Mary had a little lamb”;

                                          var word = String.elementAt(str,4,””);
                                   };


                                   Pragmas
                                   WMLScript supports the use of pragmas that specify compilation unit level information. Pragmas
                                   are specified at the beginning of the compilation unit before any function declaration.




                                     Notes  Note that all pragmas start with the keyword use and are followed by pragma-
                                     specific attributes.
                                   Syntax
                                   CompilationUnit:
                                          Pragmasopt  FunctionDeclarations
                                   Pragmas
                                          Pragma
                                          Pragmas Pragma

                                   Pragma:
                                          Use PragmaDeclaration;
                                   PragmaDeclaration:
                                          ExternalCompilationUnitPragma
                                          AccessControlPragma
                                          MetaPragma



          156                               LOVELY PROFESSIONAL UNIVERSITY
   157   158   159   160   161   162   163   164   165   166   167