Identifier Rules
- Source: https://www.freebasic.net/wiki/wikka.php?wakka=ProPgIdentifierRules
- Last revised: 2022-01-04
Naming conventions for FreeBASIC symbols.
Description
An identifier is a symbolic name which uniquely identifies a variable, Type, Union, Enum, Function, Sub, or Property, within its scope or Namespace.
Identifiers may contain only uppercase and lowercase Latin characters a-z and A-Z), digits (0-9), and the underscore character (_). The first character of an identifier must be a letter or underscore, not a digit; if an identifier's length exceeds 128 characters, it will be truncated.
Identifiers are case-insensitive: FOO and foo (and all other permutations of uppercase and lowercase) refer to the same symbol.
In the -lang qb and -lang fblite dialects, identifiers may have a type suffix at the end indicating one of the standard data types:
%forInteger&forLong!forSingle#forDouble$forString
The use of these suffixes is generally discouraged and is not allowed in the -lang fb dialect (the default).
The alternative is to be explicit - for example, Dim As Integer foo or Dim foo As Integer instead of Dim foo%.
In the -lang qb and -lang fblite dialects, identifiers may contain one or more periods (.).
Platform Differences
- Warning:
Dialect Differences
- Periods in symbol names are only supported in the -lang qb and -lang fblite dialects.
Differences from QB
- Support for the underscore character (
_) in symbol names is new to FreeBASIC.
See also
Back to DocToc