creating:evaluation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
creating:evaluation [2026/11/17 05:12] – Fixed initial definition of ENABLED ahelwercreating: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's negative: +Here's ''ENABLED'':
-<code java [highlight_lines_extra="3"]> +
-      } case MINUS: { +
-        Object operand = evaluate(expr.expr); +
-        checkNumberOperand(expr.operator, operand); +
-        return -(int)operand; +
-      } default: { +
-</code> +
-''ENABLED'':+
 <code java [highlight_lines_extra="3"]> <code java [highlight_lines_extra="3"]>
       } case ENABLED: {       } case ENABLED: {
Line 318: Line 310:
         return !(boolean)operand;         return !(boolean)operand;
       } case MINUS: {       } case MINUS: {
 +</code>
 +Negative:
 +<code java [highlight_lines_extra="3"]>
 +      } case MINUS: {
 +        Object operand = evaluate(expr.expr);
 +        checkNumberOperand(expr.operator, operand);
 +        return -(int)operand;
 +      } default: {
 </code> </code>
 Subtraction: Subtraction:
  • creating/evaluation.txt
  • Last modified: 2026/11/17 05:15
  • by ahelwer