Literal Costants

Constants are static values the nuBASIC Interpreter uses during execution of your program. 

There are two types of constants: string and numeric. 

A string constant is a sequence of alphanumeric characters enclosed in double quotation marks. 
The following are sample string constants:

 

"Hello World", "nuBASIC is written in C++11",

"Escape character \" is used to insert double quotation mark within a string"



A string consists of a sequence of consecutive individual characters. The computer saves the strings internally as a sequence of numbers where each number represents one specific character.
Character sets match characters in a string with a corresponding code (numbers and characters) in a table that describes how the computer is to display the string.
nuBASIC uses ASCII coding. The ASCII character set is a set of codes that represent numbers, characters, and special symbols by one byte. The 0 to 127 ASCII codes correspond to the alphabet and to common symbols (such as periods, parentheses, and commas), as well as some special screen and printer control codes. The ASCII character set is commonly used as a standard format for transferring text data between computers. 

Numeric constants can be positive or negative, integer (decimal or hexadecimal) or else floating point. 

Example:

-1.255 is a float

45 is an integer

&h12ABFF34 is an integer in hexadecimal format


Comments