diff options
Diffstat (limited to 'src/com/craftinginterpreters/lox/Interpreter.java')
-rw-r--r-- | src/com/craftinginterpreters/lox/Interpreter.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/craftinginterpreters/lox/Interpreter.java b/src/com/craftinginterpreters/lox/Interpreter.java index 6c32233..6b3e409 100644 --- a/src/com/craftinginterpreters/lox/Interpreter.java +++ b/src/com/craftinginterpreters/lox/Interpreter.java @@ -158,6 +158,15 @@ class Interpreter implements Expr.Visitor<Object>, Stmt.Visitor<Void> { } @Override + public Void visitWhileStmt(Stmt.While stmt) { + while (isTruthy(evaluate(stmt.condition))) { + execute(stmt.body); + } + + return null; + } + + @Override public Object visitAssignExpr(Expr.Assign expr) { Object value = evaluate(expr.value); environment.assign(expr.name, value); |