Special Characters in Code

Frequently you must use special characters in your code. In this manual, a special character is one that is not in the set of letters and numbers. You can use special characters to format your code or to specify tasks for the compiler or the compiled program. They do not specify an operation to do.

Parentheses

Function GetListCount(h_list As UInt32) As Int32
a = (1 + 2) * 3
b = 1 + 2 * 3
After run
a9
b7

Separators

Usually you write one statement on a line. But this can cause source code to become large with many space characters. Use the semicolon (;) when you want to write many small statements on one line. It can decrease the size of your code and possibly make it easier to read. The example that follows shows three statements on one line.

a = 1; b = 2; c = 3

Note: Compound statements cannot use the semicolon to put some parts together on one line. For example, Select…Case must use a minimum of three lines. These start with Select, Case, and End. Also, If…Else is always a compound statement although it has a one-line construct.

Concatenation

TODO

Member access

Dot operator

Use the operator «.» on a class or structure as a member-access operator. The member can be a field of a structure, or a property or method of a class.

Exclamation point operator

Use the operator «!» on an object variable as a dictionary-access operator. A class, trait, or Object must supply a property with the name that starts with Self! with one parameter. The parameter must have the data type String. The identifier that immediately follows the operator becomes the argument value passed to the property as a string. The example that follows shows this.

Class TestClass
    @ReadOnly Property Self!index(s As String) As Int32
    Get = Char.Code(s)
    End Property
End Class

TestClass test
PrintLine test!X
PrintLine test!y
Output:
88
121

See also