Arguments & EMPTY

Read a value passed into a subprogram and default it when the caller left it out.

A subprogram reads its inputs as local variables. Name one with a leading P — like PA12 — and you can ask whether the caller actually supplied it: IF [PA12 EQ EMPTY] GOTO N10 jumps when the argument is missing. That's how one routine serves both “use my value” and “use a sensible default” callers.

Read firstOkuma Argument & Local VariablesGuide to Okuma Mill argument and local variable conventions including naming rules, EMPTY checks, and subprogram call examples.

Your turn

Your subprogram reads a chamfer size in the argument PA12. If the caller left it out (EMPTY), fall back to a default of 0.5; otherwise use what they passed. Put the chosen value in VC1.

The machine gives you

caller passes 3.0:PA12 = 3
caller passes 1.25:PA12 = 1.25
caller omits the argument:no inputs

Your program is run once for each set of conditions. It has to work for all of them.

Loading...

This is a learning simulation — always prove out a program on the actual control before you cut metal.