Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| creating:evaluation [2026/11/17 05:12] – Fixed initial definition of ENABLED ahelwer | creating:evaluation [2026/11/17 05:15] (current) – Changed order of error check presentation ahelwer | ||
|---|---|---|---|
| Line 295: | Line 295: | ||
| Now add these checks to our interpreter code. | Now add these checks to our interpreter code. | ||
| - | Here' | + | Here's '' |
| - | <code java [highlight_lines_extra=" | + | |
| - | } case MINUS: { | + | |
| - | Object operand = evaluate(expr.expr); | + | |
| - | checkNumberOperand(expr.operator, | + | |
| - | return -(int)operand; | + | |
| - | } default: { | + | |
| - | </ | + | |
| - | '' | + | |
| <code java [highlight_lines_extra=" | <code java [highlight_lines_extra=" | ||
| } case ENABLED: { | } case ENABLED: { | ||
| Line 318: | Line 310: | ||
| return !(boolean)operand; | return !(boolean)operand; | ||
| } case MINUS: { | } case MINUS: { | ||
| + | </ | ||
| + | Negative: | ||
| + | <code java [highlight_lines_extra=" | ||
| + | } case MINUS: { | ||
| + | Object operand = evaluate(expr.expr); | ||
| + | checkNumberOperand(expr.operator, | ||
| + | return -(int)operand; | ||
| + | } default: { | ||
| </ | </ | ||
| Subtraction: | Subtraction: | ||