From c4dc0b297ff9866c48edc08b76d1098c54754f6c Mon Sep 17 00:00:00 2001 From: Kiara Barias <33493552+Kbarias@users.noreply.github.com> Date: Thu, 14 Nov 2019 15:07:08 -0500 Subject: [PATCH] Switch statement example updated (#37757) * Switch statement example updated * Update switch-statements.english.md example Co-Authored-By: Oliver Eyton-Williams * Update switch-statements.english.md example Co-Authored-By: Oliver Eyton-Williams --- ...y-options-with-switch-statements.english.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.english.md index 43891c9604..7fe5b87807 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.english.md @@ -8,20 +8,16 @@ forumTopicId: 18277 ## Description
-If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which define various possible values. Statements are executed from the first matched case value until a break is encountered. -Here is a pseudocode example: +If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which define various possible values. Statements are executed from the first matched case value until a break is encountered. +Here is an example of a switch statement: ```js -switch(num) { - case value1: - statement1; +switch(lowercaseLetter) { + case "a": + console.log("A"); break; - case value2: - statement2; - break; -... - case valueN: - statementN; + case "b": + console.log("B"); break; } ```