From 79bdee91d05795e5ee24158171d5c1045d89d31a Mon Sep 17 00:00:00 2001 From: Araozu Date: Mon, 20 May 2024 16:53:14 -0500 Subject: [PATCH] small changes --- src/components/InteractiveCode.astro | 4 +- src/pages/learn/error-handling/try.mdx | 71 ++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/src/components/InteractiveCode.astro b/src/components/InteractiveCode.astro index 014faba..4d650ae 100644 --- a/src/components/InteractiveCode.astro +++ b/src/components/InteractiveCode.astro @@ -176,7 +176,7 @@ const serialized_inst = JSON.stringify(instructionSet); break; } case InstructionType.Out: { - data.stdout += i.v0 + data.stdout += i.v0.slice(1, -1) + "\n" break; } case InstructionType.Set: { @@ -186,7 +186,7 @@ const serialized_inst = JSON.stringify(instructionSet); break; } case InstructionType.Unset: { - delete data.state[i.v0]; + delete data.state[i.v0.slice(1, -1)]; break; } } diff --git a/src/pages/learn/error-handling/try.mdx b/src/pages/learn/error-handling/try.mdx index 885e632..ac2871e 100644 --- a/src/pages/learn/error-handling/try.mdx +++ b/src/pages/learn/error-handling/try.mdx @@ -153,17 +153,70 @@ In the previous example: Try/return will assign a new value if an expression fails. -```thp -fun run() -{ - val result = try dangerous() else 322 + + + +- If `possible_value` is an error, the value `666` is used. +- If `possible_value` is not an error, its value will be used. Either way, the function will continue executing.