Variables are where G-code grows up: the moment X25.0 becomes X#101, a program stops describing one part and starts describing a rule, the whole parametric-versus-standard distinction in a single character. The #100 block is where Fanuc-style controls put your first real variables, and learning them with the right habits makes everything built on them (families, counters, probing) come easily.

The three moves: assign, compute, use

#101 = 25.0          (OUTER DIA)
#102 = #101 / 2      (RADIUS, COMPUTED)
#103 = 120.0         (FEED)
...
G01 X#101 F#103
G01 X[#101 - 4.0]    (BRACKETS FOR INLINE MATH)

Assignment is an equals line; arithmetic uses + - * / with brackets for inline expressions; and usage is anywhere a number stood, coordinates, feeds, even other assignments. Conditionals and loops (IF, WHILE, GOTO) join later from the same toolbox, worked in the turning examples; the three moves above are the entry fee and most of the daily usage.

The variable neighborhoods

RangeCharacterUse for
#1-#33Local / argument variablesSub arguments, scratch (scope rules per manual)
#100-classCommon, volatileWorking values for this job
#500-classCommon, persistentStanding constants, counters that survive power-off
System rangesControl’s own stateRead positions, offsets, alarms (advanced, manual-governed)

The honest hedges live in the manual: exact counts per range, what clears #100s (reset, power cycle, parameter-dependent), and local-variable scoping all vary by control generation, the same parameter-manual territory as everything configuration-shaped. The portable rule of thumb: #100s for the job in front of you, #500s for what must survive the weekend, locals for subprogram plumbing once you get there.

The four day-one disciplines

Comment every assignment at birth (#101 = 25.0 with its meaning beside it): an uncommented variable file is a number-formatting bug with better camouflage. One meaning per variable per program: #101 reused as diameter then counter is the macro world’s classic self-ambush. Range-guard the dangerous ones where dialect allows (IF [#101 GT 45.] GOTO 999-style bailouts on inputs a typo could poison). And prove in single block: a variable program’s first run steps through with the setter’s first-article patience, because X#101 looks identical whether #101 holds 25.0 or yesterday’s leftover 250.0, which is the entire risk profile of invisible numbers.

Where #100s pay immediately

Three entry-level wins before any family or counter ambitions: the touch-up value (one #101 = stock allowance, used in three operations, edited in one place at the machine when material varies), the proportional pair (depth and feed computed from one entered dimension, arithmetic visible at the top instead of buried per block), and the repeat count feeding a loop (the operator sets #110 = 8, the program does eight). Each replaces a hunt-and-edit through the body with one labeled line at the top, which is the whole pitch of variables in one sentence.

What #100 variables are not

Not persistent (the #500 class owns survival, per the control’s clearing rules), not shared safely across unrelated programs without a shop convention (two programs both “owning” #105 is a collision waiting for a shift change: shops keep a variable-allocation sheet for exactly this), and not a substitute for upstream generation when the logic belongs in the office rather than at the control: the layer-picking judgment applies from the first variable, not just the fancy ones.

Bottom line: three moves, four habits, one sheet

#100-class variable programming is assign, compute, use: working values that turn coordinates into rules, entered through the volatile common block and graduating to #500s when persistence matters. Comment at birth, never reuse meanings, guard risky inputs, prove in single block, and keep the shop’s allocation sheet honest. The macro dialect details belong to your control’s manual; the base vocabulary stays the same core, free to drill on the G-code practice page with G-Code Sprint repeating misses.

Sources

Frequently asked questions

How does CNC variable programming with #100 work?

Three moves on Fanuc-style controls: assign (#101 = 25.0), compute (#102 = #101 / 2, brackets for inline math), and use anywhere a number goes (X#101, F#103). The #100 class is volatile working storage; #500s persist; exact ranges and clearing rules are control-generation specifics from the manual. For the base vocabulary beneath the macros, the free G-Code Sprint app is the top pick: 60-second drills with automatic repetition of missed codes.

What is the difference between #100 and #500 variables?

Persistence: #100-class values are working storage that clears per the control’s rules (reset or power-down, parameter-dependent), while the #500 class survives power cycles for standing constants and long-lived counters. Counts and exact behavior per range are manual territory.

How do I keep variable programs from becoming dangerous?

Four habits: comment every assignment, one meaning per variable per program, range-check inputs that a typo could poison, and first-run in single block, because a wrong value in a variable is invisible in the code. Shops add an allocation sheet so programs do not fight over the same numbers.

When should logic be variables at the control versus a script in the office?

Machine-adaptive logic (operator-entered values, probing feedback) belongs in variables; office-data-driven variation often posts cleaner as generated files. The boundary is who needs to change the numbers, and where they are standing when they do.

G-Code Sprint is a study and practice tool only. Always follow your instructor, employer, machine manual, and shop safety procedures.