Identify the failing stage
Check the file path first. A syntax error occurs while reading the program structure. A runtime error occurs while executing a valid expression with particular values. An error from a native build can point to a type mismatch or a missing Rust toolchain.
| Observation | Likely cause | First action |
|---|---|---|
| A parser line and column | Missing punctuation or an unfinished expression | Inspect that token and the preceding statement. |
| index … out of bounds | The index fell outside the vector | Check 0 <= i and i < len(v) before at. |
| dot requires vectors of equal length | The inputs contain different numbers of observations | Compare both lengths. |
| step limit exceeded | The budget ran out | Trace the loop condition and its updates. |
Reproduce the smallest failure
Save fn main() { println!(1 / 0); } as divide.blyx. A syntax check succeeds because the expression is well formed. Running it reports an integer division error and exits with code 4. Replace the zero with 2 and rerun. Whole-number division now prints 0.
Put a guard before division
The example reads count != 0 && total / count > 3. With a zero count the first comparison is false, so evaluation skips the division. Reversing the operands would evaluate the division before discovering the zero.
Limit a test run
A runaway loop can repeatedly evaluate valid code. Use a small positive budget while investigating it. The released interpreter also enforces a separate call-depth limit. Increasing the budget only helps after you have confirmed that the computation progresses.
blyxc run src/main.blyx --max-steps 10000Try the program
Expected output
false true
Practice
Make the second call use a nonzero count whose integer quotient is exactly three.
Hint
Keep total at 12 and choose a count that divides it evenly.
Worked solution
The quotient 12 / 4 is 3. The strict > 3 comparison returns false, and the zero-count case also returns false.
Find
above_limit(12, 2)Replace with
above_limit(12, 4)Output after the change
false false