As already noted, you can declare your own keywords for use in calls to procedures, functions, and complex statements. However, some identifiers are always keywords.
Keyword | Details |
---|---|
abstract† | used to mark a class as abstract (not ready to be instantiated) |
abstract† | used to mark a method or property as a abstract (use in place of virtual) |
and | Boolean AND operator |
band | Bitwise AND operator |
base | used to access a base class; See [Derivation] for more information |
bitfield† | Marks the start of a bitfield; see [Bitfields] for more information |
bnor | Bitwise NOR operator—shortcut for bnot(a band b) |
bnot | Bitwise NOT operator |
bor | Bitwise OR operator |
break | used to interrupt a complex statement or end a case clause inside a switch statement |
bxnor | Bitwise XNOR operator—shortcut for bnot a band bnot b |
bxor | Bitwise XOR operator—shortcut for (a band bnot b) bor (bnot a band b) |
byvalue | When a formal parameter, return type, variable, or data member is declared with this type modifier and the type would normally be a reference type, forces the compiler to use store it by value instead; If a formal parameter was declared with byvalue, byvalue must also proceed the actual parameter; See also [By value versus by reference] |
case† | Used with switch and else to implement a switch statement |
catch† | used to handle an exception |
class | used to declare a class |
command | used to declare a command |
conditional† | used in place of var to create a variable that’s meant control whether later code should or shouldn’t be ignored; these variables correspond to #DEFINE in C; must be a global variable; the type used must be const and declared in a project that’s already compiled; see [Conditional compilation] for more information |
conditionalif | Like if, but meant for conditional compilation use; corresponds to #if in C; See [Conditional compilation] for more information |
const | when used as a class modifier, declares the class is immutable |
const | when used as a modifier before the command/function/statement keyword used to declare a method, specifies the method won’t change any member and can be called on a constant instance. |
const | when used in place of var, declares a named constant (can be any immutable type) |
const | when used with var in the form "var const String name ", declares a String where the String is constant, but the reference to the String isn’t (also how you declare a function that returns a reference to a constant object) |
constructor | a type of procedure that must be a member of a class and initialize the class; static constructors initialize the static members; default constructors are provided automatically by the compiler |
creator | used to run additional code in allocation so that the new operator knows how much memory to allocate (runs before the constructor and returns the number of extra words to allocate; most classes don’t need this) |
delegate | A type similar to a function pointer in C; The C# delegates are very similar; See [Delegates] for more information |
destructor | a type of procedure that cleans up; many classes don’t require one; the compiler provides one if one isn’t declared; destructors are called by the garbage collector |
div | Integer division operator |
else† | used with if and then to build if statements; used with conditionalif and then in [Conditional compilation] |
enum | Enumeration type; See [Enums] for more information |
event | a type used to create events; See [Events] for more information |
exists† | When inside a conditionalif statement, causes a comparison to check if a conditional variable exists rather than doing something with its value. See [Conditional compilation] for more information. |
expression† | When used in place of var when declaring a run-time parameter, causes the program to reevaluate the expression each time it’s referenced. The type modifiers ref, out, byvalue, and const are invalid in expression declarations. |
explicit† | Requires that a type cast be explicitly used before the compiler can apply it |
extends† | used to derive classes, structs, or interfaces |
final† | when applied to a class declaration, prevents other classes from deriving from this class |
final† | when applied to the declaration of a virtual method or property, prevents derived classes from overriding the method or property |
finally† | used to clean up after an exception |
function | used to declare a function |
get† | used to declare the get accessor for a property |
if | used with then and else to build if statements |
implements† | used to implement an interface |
implicit† | causes a type cast procedure to one that the compiler can apply implicitly without any code |
inner† | when applied to the declaration of nested class, causes it to be associated with a specific instance of the enclosing class; the closest equivalent would be non-static inner classes in Java |
instructions† | used to call instructions that are passed to a complex statement |
interface | used to declare an interface |
mod | Modulus integer operator |
new | When used inside a class or struct declaration, allows you to declare something that would hide a member of one of the base classes. |
new | When used inside code, this is an operator that allocates memory |
next | used to tell a complex statement to start a loop over |
nor | Boolean NOR operator—shortcut for not(a and b) |
not | Boolean NOT operator |
null | a special value for all reference types indicating the variable has no value |
onbreak† | Special label that the code jumps to inside a complex statement when it encounters the break keyword |
onnext† | Special label that the code jumps to inside a complex statement when it encounters the next keyword |
operator† | used to declare an operator override |
or | Boolean OR operator |
out | Like ref, but tells the compiler the caller will initialize the parameter and is valid for parameters only; If a formal parameter was declared with out, the actual parameter must be proceeded with out as well |
override† | used to override a virtual or pure virtual method or property (use in place of virtual) |
params✽ | In DASIL, each script takes an array of strings with this name; the entries are the parameters passed to the script |
private† | used to mark a module, class, or struct member as private |
property | used to declare a property; use in place of var (You must declare either a get or set clause inside each property) |
protected† | used to mark a module, class, or struct member as protected |
public† | used to mark a module, class, or struct member as public |
readonly | used to declare a var that can’t be changed once initialized (must be initialized by either the declaration or the constructor) |
ref | Marks a formal parameter, return type, variable, or data member as being passed by reference; If a formal parameter was declared with ref, the actual parameter must be proceeded with ref as well |
rem† | Marks the start of a comment that extends to the end of the line; must start the line |
return | used to return from a procedure; when used in a function, specifies the return value |
returns† | used to tell a function what it returns |
set† | used to declare the set accessor for a property |
statement | used to declare a complex statement |
static† | marks a member or method such that the compiler creates one and only one for the class |
static† | when placed in front the class keyword, causes all members and methods inside that class to become implicitly static |
structure | used to declare a structure |
switch | Used with case and else to implement a switch statement |
then†‡ | used with if and else to build if statements; used with conditionalif and else in [Conditional compilation] |
throw | used to throw an exception |
throws† | used to specify that a procedure, function, or complex statement can result in an exception that the caller must handle |
try | Used to start a block of code that might throw exceptions and you want to handle those exceptions |
typealias† | Declares a type alias; See [Type aliases] for more information |
typecast† | Declares a special type of method for type casting. See [Type casts] for more information. |
undeclare✽ | Used to undeclare a global (to that namespace) identifier |
union† | Marks the start of a union; see [Unions] for more information |
using† | Provides a way to force a local variable to go out of scope. |
value† | used in set accessors to object the value passed by the user (not a keyword in other contexts) |
values† | Special keyword used to begin a block listing the values for a struct-based enum type; not reserved outside struct-based enum types |
var | used to declare a variable (either local or global), a data member of a structure/class, or a run-time parameter |
virtual† | used to mark a method or property as virtual |
volatile | Tells the compiler that a data variable or member may be changed at any time by code in an external module: var volatile string s = "sdf" |
where† | Used to declare type restrictions on a generic type parameter |
xnor | Boolean XNOR operator—shortcut for not a and not b |
xor | Boolean XOR operator—shortcut for (a and not b) or (not a and b) |
Keywords marked with † are only treated as keywords in select circumstances.
Keywords marked with ‡ maybe dropped. They have little to no use in ASIL.
Keywords marked with ✽ are only valid in DASIL scripts.
If you need a keyword (reserved or otherwise) as an identifier other than a custom keyword, prefix the keyword with @. This will cause the parser to look for something besides a keyword.
Wiki: Bitfields
Wiki: By value versus by reference
Wiki: Conditional compilation
Wiki: Delegates
Wiki: Derivation
Wiki: Derivatives-DASIL
Wiki: Enums
Wiki: Events
Wiki: Home
Wiki: Type aliases
Wiki: Type casts
Wiki: Unions
Wiki: keywords-abstract
Wiki: keywords-base
Wiki: keywords-bitfield
Wiki: keywords-break
Wiki: keywords-byvalue
Wiki: keywords-case
Wiki: keywords-catch
Wiki: keywords-class
Wiki: keywords-command
Wiki: keywords-conditional
Wiki: keywords-conditionalif
Wiki: keywords-const
Wiki: keywords-constructor
Wiki: keywords-creator
Wiki: keywords-delegate
Wiki: keywords-destructor
Wiki: keywords-else
Wiki: keywords-enum
Wiki: keywords-event
Wiki: keywords-exists
Wiki: keywords-explicit
Wiki: keywords-expression
Wiki: keywords-extends
Wiki: keywords-final
Wiki: keywords-finally
Wiki: keywords-function
Wiki: keywords-get
Wiki: keywords-if
Wiki: keywords-implements
Wiki: keywords-implicit
Wiki: keywords-inner
Wiki: keywords-instructions
Wiki: keywords-interface
Wiki: keywords-new
Wiki: keywords-next
Wiki: keywords-null
Wiki: keywords-onbreak
Wiki: keywords-onnext
Wiki: keywords-operator
Wiki: keywords-out
Wiki: keywords-override
Wiki: keywords-params
Wiki: keywords-private
Wiki: keywords-property
Wiki: keywords-protected
Wiki: keywords-public
Wiki: keywords-readonly
Wiki: keywords-ref
Wiki: keywords-rem
Wiki: keywords-return
Wiki: keywords-returns
Wiki: keywords-set
Wiki: keywords-statement
Wiki: keywords-static
Wiki: keywords-structure
Wiki: keywords-switch
Wiki: keywords-then
Wiki: keywords-throw
Wiki: keywords-throws
Wiki: keywords-try
Wiki: keywords-typealias
Wiki: keywords-typecast
Wiki: keywords-undeclare
Wiki: keywords-union
Wiki: keywords-using
Wiki: keywords-value
Wiki: keywords-values
Wiki: keywords-var
Wiki: keywords-virtual
Wiki: keywords-volatile
Wiki: keywords-where
Wiki: operators-and