Constants

From RemObjects Software

Jump to: navigation, search

This is a Oxygene Language Feature topic
Feel free to add your notes to this topic below.



Constants (const) are values calculated at design time and they cannot be modified during program execution. A const takes two forms:

type
  MyClass = class
    const
      i1: Integer = 5;
      i2 = 10;
    ...
  end;

If the absolute type is not provided, Oxygene assigns the one most appropriate for the const's value.

Constant Types

Constants can be complicated expressions, but they are all built from Letter, Char, StringConstant and/or Digit. The following list shows the formal description of the various const types:

Type
Format
Examples

<Letter>

'a'...'z' | 'A'...'Z' | '_'

'm' 'M' '_'

<Literal>

<Number> | <String> | <Char>

27 'abc' #27

<Number>

<Integer> | <Float>

42 4.2

<Integer>

{ <Digit> } | '$' { <HexDigit> }

123 $FE

<Digit>

'0'...'9'

5

<HexDigit>

<Digit> | 'a'...'f' | 'A'...'F'

5 c C

<Float>

{ <Digit> '.' { <Digit> } e or E can be part of the expression

123.45 10e15 1234.56e7

<String>

{ <Char> | <StringConstant> }

  1. 44 'abc'

<StringConstant>

0x34 | 0x39 { 0x0032...0x0038 | 0x0040...0xffff | 0x39 0x39 } 0x39 | 0x34

'abc' "abc"

<Char>

'#' <Integer>

  1. 60


See Also


Product: RemObjects Oxygene (formerly known as Chrome)
Current version: 3.0 Previous Versions: 'Joyride' (2.0), 'Floorshow' (1.5), 'Adrenochrome' (1.0)

GlossaryKeywordsLanguage FeaturesPlatform FeaturesSamplesArticlesHow ToIssues

Personal tools