Wiki
Version 3 (modified by todd.a, 7 years ago)

--

Keywords in Alphabetical Order

abstract adds all and any as assert base be body bool branch break callable catch char class const continue cue decimal def do dynamic each else end ensure enum event every except expect extend extern fake false finally float for from get has if ignore implements implies import in inherits inlined inout int interface internal invariant is listen lock mixin must namespace new nil nonvirtual not number objc of off old on or out override par partial pass passthrough post print private pro protected public raise ref require return same set shared sig stop struct success test this throw to to? trace true try uint use using var vari virtual where while yield

Keyword Reference Data

In the compiler source code is an index of all keywords including name, "reserved" indicator, area (such as statement or contracts) and description. You can find this in CobraWorkspace/Source/KeywordSpecs.cobra which you can view online.

Furthermore, there is a small utility program in CobraWorkspace/Supplements/keywords.cobra that gives programmatic access to this reference data without having to reference the rest of the compiler.

Keywords as Member Names

A method can have the same name as a keyword:

class A

    def print
        print .toString

    def main
        .print   # invoking a method whose name coincides with a keyword

The methods and properties of a class, struct or interface can use keywords as their names. For example, you can create a property called "lock" or a method called "branch". This is possible because in Cobra, properties and methods are always accessed through a dot (.) such as "obj.foo", unless the member name starts with an underscore such "_foo" which can be invoked directly. Obviously a method that starts with an underscore will not coincide with any keyword above.

See Also

LanguageTopics