swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Related Syntax  

Integer data type

You can use the integer data type to store and manipulate integer values between -2,147,483,648 to 2,147,483,647. In a future version of OmniMark, integers will become unbounded, so you should avoid writing code which depends on the current size limit of integers or on the wrapping of values which occurs when you exceed the maximum or minimum values of an integer. For instance, in current OmniMark, the expression 2,147,483,647 + 10 gives the result -2147483639. In a future version it will give the result 2147483657.

Integer data type formatting lets you move the decimal place, change the padding from blanks to zeros, or suppress trailing zeros.

If you need to write code that depends on the specific behavior of 32-bit integers, or if you need to represent a 32-bit bit field, you should use the int32 data type.

Because any string expression can be used as a numeric value, saved pattern text, attribute values, and even element content can be used as a numeric value, provided that the contents form a valid number.

Numbers with a radix other than 10 must be expressed as a string expression, and can be converted to a numeric expression using the operator base.

You can specify an integer with underscores:

      process
         local integer x
         set x to 1_000_000
         output "Number is %d(x)"
      ; The output will be "Number is 1000000"

Integers are automatically initialized to 0.

You can initialize integer variables when you declare them:

  global integer quantity initial {0}

You can set the value of an integer to the value of a numeric literal, another integer, the result of an integer expression, or a stream expression or literal string that evaluates to an integer value:

  set quantity to 5
  set quantity to number-of-things
  set quantity to number-of-children * apples-per-child
  set quantity to form-data{"quantity"}
  set quantity to "27"

You can use the following operators with integers:

See data type conversion for information on how to convert from integer to other data types and vice versa.

For information on how to represent hex numbers, octal numbers and others in which you convert a string to a number, see base.

    Related Syntax
   global, local, constant, field
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:25:49 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.