# 2.3.1.2.1.3 Command Statements

The third statement type is the command statement. LabTalk offers commands to control or modify most program functions.

Each command statement begins with the command itself, which is a unique identifier that can be abbreviated to as little as two letters (as long as the abbreviation remains unique, which is true in most cases). Most commands can take options (also known as switches), which are single letters that modify the operation of the command. Options are always preceded by the dash "-" character. Commands can also take arguments. Arguments are either a script or a data object. In many cases, options can also take their own arguments.

Command statements take the general form:

command [option] [argument(s)];

The brackets [] indicate that the enclosed component is optional; not all commands take both options and arguments. The brackets are not typed with the command statement (they merely denote an optional component).

Methods (Object) are another form of command statement. They execute immediate actions relating to the named object. Object method statements use the following syntax:

ObjectName.Method([options]);

#### For example:

The following script adds a column named new to the active worksheet and refreshes the window:

//turn off Spreadsheet Cell Notation firstly
page.xlcolname = 0;
doc -uw;

#### The following examples illustrate different forms of command statements:

Integrate the dataset myData from zero.

integ myData;

Adding the -r option and its argument, baseline, causes myData to be integrated from a reference curve named baseline.

integ -r baseline myData;

The repeat command takes two arguments to execute:

1. the number of times to execute, and
2. a script, which indicates the instruction to repeat.

This command statement prints "Hello World" in a dialog box three times.

repeat 3 {type -b "Hello World"}