[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

Literals

Numbers (numeric literals) represent a numeric value. They are in conventional base 10 (by default) can contain a decimal point. Numbers can also have an underscore (underline character) which does not affect the meaning: underscores may be used to break up a long number for readability.

An alternate base (hex, octal, etc.) can be specified by following the base with the value between '#'. The minimum base is 2 (binary) and the maximum base is 16 (hexadecimal). Hexadecimal letter characters can be in upper or lower case.

Scientific notation (a power of 10 exponent) is not yet supported.

=> ? 16#FFFF#
65535
  • 5 - the numeric value 5
  • 5.0 the numeric value 5.0
  • 10_000 the numeric value 10,000
  • 8#777# - the octal value 511
  • 16#ff# - the hexadecimal value 255

All numeric literals are of type univeral_numeric.

Characters are enclosed in single quotes. It must be only one graphic character bracketed by two single quotes (also called apostrophes).

  • 'a' - the character a

Strings are enclosed in double quotes. They are a sequence of zero or more graphic characters bracketed by two double quotes.

  • "hello" - the string hello

All string or character literals are of type universal_string.

Ada: In Ada, the number 5 is an integer and 5.0 is a real literal (float). Here they are both universal_numeric. In Ada, "hello" is a string and 'c' is a character. Both are universal_strings here.


 
[Right Submenu]

 AdaScript versus GCC

 Case Sensitivity

 Reserved Words

 Comments

 Literals

 Bourne Shell Word Expansions

 Fundamental Types

 User-defined Types

 Enumerated Types

 Arrays

 Records

 Basic Assignment

 The @ and % Operands

 Command Argument Shortcuts

 Redirection and Pipelines

 Command Line Interaction

 Built-in Shell Commands

 The Current Directory

 Database Commands

 Flow of Control

 Other Statements/ Subprograms

 External Commands

 Block Statements and Subprograms

 TCP/IP Sockets

 Numeric Formatting with Put

 Interpreter Directives

 Command Line Options

 Command Reference

 ASCII and Latin_1 Character Sets

 Common Error Messages

 Common PHP Functions and the SparForte Equivalent

[Back to Top] Back To Top [Small Forte Symbol]