Home News DOC Class DL Others Cooker
Documents  >  Tutorial  >  Call
Call statement

The call statement invokes a method.


Table of contents:


Format

Expression

Semicolon

Example

Format

The format of the call statement is:


expression ;


It is a statement that ends with a method call followed by a semicolon.

A return value of the method is ignored.

Expression

It is an expression that ends with a method call.


If the call expression has a dot operator, the call statement calls the method of the instance returned by the expression to the left of the last dot.

If the call expression does not have a dot operator, the call statement calls the method in the current class definition.

Semicolon

The end of a call statement is represented by a semicolon.

Example

1:

class example

2:

int var1;

3:

open method void someMethod(int arg)

4:

var1 = arg;

5:

em

6:

open method void someMethod2(int arg)

7:

someMethod(arg);

8:

em

9:

ec

1:

example ex;

2:

ex.someMethod(10);

Next
Previous
Copyright © Rice All rights reserved.