# 3.7.5.38 Macro

LabTalk Object Type:

Utility

The macro object contains one property which, when inside a macro, contains the value for the number of arguments.

## Properties:

Property Access Description
numeric

Inside any macro, this property contains the value for the number of arguments.

## Examples:

This script defines a macro called TypeArgs. If three arguments are passed to the TypeArgs macro, the macro types the three arguments to the Script window.

Def TypeArgs
{
if (macro.narg != 3)
{
type "Error! You must pass 3 arguments!";
}
else
{
type "The first argument passed was %1.";
type "The second argument passed was %2.";
type "The third argument passed was %3.";
}
};

If you define the TypeArgs macro as in the example, and then type the following in the Script window:

TypeArgs One;

Origin returns the following to the Script window:

Error! You must pass 3 arguments!

If you define the TypeArgs macro as in the example, and then type the following in the Script window:

TypeArgs One Two Three;

Origin returns the following to the Script window:

The first argument passed was One.

The second argument passed was Two.

The third argument passed was Three.