literal data-item Parenthesized-expression non-parameterized-member-access method-invocation-expression chained-constructor object-creation-expression delegate-invocation-expression subscript-expression reference-modification-expression concatenation-expression cast-expression type-of-expression anonymous-method-expression method-group-expression arithmetic-expression size-of-expression table-of-expression unary-expression binary-expression conditional-expression await-expression
Where:
Any parameter defined by the method that does not correspond either to one of the positional arguments, or to one of the named arguments, must be an optional parameter (i.e. a parameter with a default value).
Where:
None of positional-argument, named-argument, or property-initializer should reference instance data or local data. Typically they reference arguments of the current constructor.
Where:
Any parameter defined by the constructor that does not correspond either to one of the positional arguments, or to one of the named arguments, must be an optional parameter (i.e. a parameter with a default value).
Where:
Any parameter defined by the delegate that does not correspond either to one of the positional arguments, or to one of the named arguments, must be an optional parameter (i.e. a parameter with a default value).
Where:
myArray[5] *> sixth item in the array
Square brackets can also be used to pass the parameters to an indexer expression.
myArray(5) *> fifth item in the array
The primary expression must be of type string. The offset must be of integral type. The length expression may be omitted but, if specified, must be of integral type.
The result of a reference modification expression is a string value formed by taking a substring of the original string starting from the specified offset (0 based), for the specified length, or until the end of the original string if length expression is omitted.
If the offset expression, or the sum of the offset expression and the length expression, is greater than the original string length an exception is thrown.
where the right-hand primary-expression is not itself a concatenation expression. The result of a concatenation expression is a string value formed by concatenating all the operands. If any operand is not itself of type string, the ToString (.NET) or toString(JVM) method is applied to the operand before it participates in the concatenation.
The cast expression is used to specify an explicit conversion, for example, reference type conversion or explicit user conversion. If you do not specify the optional IF and the cast fails, an exception is thrown (InvalidCastException for .NET or ClassCastException for JVM); if you specify IF and the cast fails, no exception is thrown and the target object is set to null. See the Explicit reference conversions section for more information.
DELEGATE procedure-division END-DELEGATE
The procedure division may start with a procedure division header, which can specify zero or more parameters and an optional returning item.
The expression represents any of the methods with the given name belonging to the specified type. For instance methods, the method group expression also encapsulates an object instance.
Method group expressions are implicitly converted to a delegate type by selecting the member of the method group which is compatible with the delegate type.
Example:
01 del type MyDelegate. 01 o type MyType. set del to method o::Meth1
The compiler will set del to point to the override of Meth1 in MyType, which has the same signature as MyDelegate.
An arithmetic expression may be either a unary expression or a binary expression. In both cases, the expressions which are subject to operations may be:
Helps create an array inline in .NET COBOL.
For example:
set myArray to table of ( "abc", "bcd" )
This is equivalent to:
set content of myArray to ( "abc", "bcd" )
An example of creating a multi-dimensional array:
declare myArray as string occurs any any = table of string ( ("abc", "def") ("ghi", "jkl") )
Where unary-operator is one of '+', '-', or 'b-not'.
Where binary-operator is one of '+', '-', '*', '/', '**', 'b-and', 'b-or', 'b-xor', 'b-left', or 'b-right'.
The order of evaluation can be modified by making use of parenthesized expressions.
A conditional expression may be a primary conditional expression or a combined conditional expression.
A primary conditional expression may be:
A relational operator is one of the following, where each line includes variants for the same operator.
= | EQUALS | |
<> | NOT= | NOT EQUALS |
> | GREATER [THAN] | |
< | LESS [THAN] | |
>= | NOT< | GREATER [THAN] OR EQUAL
NOT LESS [THAN] |
<= | NOT> | LESS [THAN] OR EQUAL
NOT GREATER [THAN] |
An INSTANCE OF expression is of the form:
A CONTAINS expression is of the form:
where expression-1 evaluates to either:
The type of primary-expression must implement the method GetAwaiter(). If the type returned by this GetAwaiter method has a GetResult method, then the type of the await-expression is the same as the type returned by this GetResult method. Otherwise, the type of the await-expression is void.
A void await-expression can be specified by using an INVOKE statement:
A non-void await-expression can be used wherever an expression of its resolved type can be used.
In most cases, the type of the primary-expression will be one of System.Threading.Tasks.Task or System.Threading.Tasks.Task[T], which satisfy the above conditions. In the first case, the type of the await-expression is void, and in the second case the type of the await-expression is T.