From 80a3b56f8ef588ea9f05d63aeabfbb901a9961e2 Mon Sep 17 00:00:00 2001 From: Alexander Zub <35890159+AlexanderFarkas@users.noreply.github.com> Date: Mon, 25 Mar 2024 05:46:14 +0700 Subject: [PATCH] Fix chapter08_statements.md Once REPL encounters an error, it stops interpreting valid statements, since hadError is never set to false. --- note/answers/chapter08_statements.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/note/answers/chapter08_statements.md b/note/answers/chapter08_statements.md index 87fe3f840..8fa53e600 100644 --- a/note/answers/chapter08_statements.md +++ b/note/answers/chapter08_statements.md @@ -91,7 +91,10 @@ Object syntax = parser.parseRepl(); // Ignore it if there was a syntax error. - if (hadError) continue; + if (hadError) { + hadError = false; + continue; + } if (syntax instanceof List) { interpreter.interpret((List)syntax);