Challenge - 5 Problems
Loop Mastery in CNC Macros
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediateOutput of loop count in CNC macro
What is the value of variable #100 after this CNC macro loop finishes?
CNC Programming
O1000; #100=0; WHILE[#100 LT 5] DO1; #100=#100+1; END1; M30;
Attempts:
2 left
💡 Hint
Count how many times the loop increments #100 before the condition fails.
✗ Incorrect
The loop runs while #100 is less than 5, incrementing #100 each time. It stops when #100 reaches 5.
📝 Syntax
intermediateIdentify syntax error in CNC loop
Which option contains a syntax error in the CNC macro loop?
Attempts:
2 left
💡 Hint
Check for missing semicolons and correct loop syntax.
✗ Incorrect
Option B is missing a semicolon after DO1, causing a syntax error.
🔧 Debug
advancedWhy does this CNC loop never end?
Given this CNC macro code, why does the loop never finish?
CNC Programming
O2000; #1=1; WHILE[#1 LE 5] DO1; #2=#2+1; END1; M30;
Attempts:
2 left
💡 Hint
Check which variable controls the loop condition and if it changes.
✗ Incorrect
The loop condition depends on #1, but #1 is never changed inside the loop, so the condition is always true.
🚀 Application
advancedCalculate total cuts in nested loops
How many total cuts are made if this CNC macro runs?
CNC Programming
O3000; #100=0; #200=0; WHILE[#100 LT 3] DO1; #200=0; WHILE[#200 LT 4] DO2; #200=#200+1; END2; #100=#100+1; END1; M30;
Attempts:
2 left
💡 Hint
Multiply the counts of the outer and inner loops.
✗ Incorrect
Outer loop runs 3 times, inner loop runs 4 times each outer iteration, total cuts = 3 * 4 = 12.
🧠 Conceptual
expertEffect of loop variable scope in CNC macros
In CNC macro programming, what happens if you use the same variable for nested loops without resetting it inside the inner loop?
Attempts:
2 left
💡 Hint
Think about how variable values persist between loops.
✗ Incorrect
Using the same variable without resetting causes the inner loop to start with a value changed by the outer loop, possibly skipping iterations.
