From bbcfe9079e8db8561edf5b609e70316ecc979c08 Mon Sep 17 00:00:00 2001 From: dumpstring <100595391+dumpstring@users.noreply.github.com> Date: Sun, 27 Oct 2024 01:46:19 +0200 Subject: [PATCH] fix the markdown again. --- docs/switch-for-statements.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/switch-for-statements.md b/docs/switch-for-statements.md index 698566f..ece589b 100644 --- a/docs/switch-for-statements.md +++ b/docs/switch-for-statements.md @@ -39,7 +39,9 @@ This syntax adds a pattern not found in Luau, and may necessitate concepts for d ## Alternatives -For instance, in the absence of a syntax for `switch`, developers depend on `if`-`elseif` chains: In the absence of a syntax for `switch`, developers have to depend on `if`-`elseif` chains, which often become cumbersome and harder to read with multiple values to check. To that effect, consider handling the fall-through behavior of `switch` statements. Here every condition is explicitly repeated; thus, code becomes more verbose and error-prone: ```lua if value == "a" then +For instance, in the absence of a syntax for `switch`, developers depend on `if`-`elseif` chains: In the absence of a syntax for `switch`, developers have to depend on `if`-`elseif` chains, which often become cumbersome and harder to read with multiple values to check. To that effect, consider handling the fall-through behavior of `switch` statements. Here every condition is explicitly repeated; thus, code becomes more verbose and error-prone: + +```lua if value == "a" then -- Code for case "a" elseif value == "b" then -- Code for case "b" @@ -48,8 +50,6 @@ elseif value == "c" or value == "d" then else -- Default case end - ``` Using the above chained `if`s, the convenience a `switch` provides is consumed by repeated comparisons and explicit coding of fall-through behavior. This can result in longer branching code and is more annoying to maintain when cases are added or altered. -```