From 635e159e78671a178cb71d4cdd969cc0679da7e2 Mon Sep 17 00:00:00 2001 From: mtrigueros Date: Tue, 29 Oct 2019 06:54:31 -0600 Subject: [PATCH] Add exercise questions for continue & break --- .../JavaScript_Basics/continue_break.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/Exercise/JavaScript_Basics/continue_break.md diff --git a/docs/Exercise/JavaScript_Basics/continue_break.md b/docs/Exercise/JavaScript_Basics/continue_break.md new file mode 100644 index 0000000..b169f43 --- /dev/null +++ b/docs/Exercise/JavaScript_Basics/continue_break.md @@ -0,0 +1,28 @@ +### Continue Exercise +1. **Sets** a variable before the loop starts (var i = 0). +2. **Make** the loop continue when i is 2 and 7 +3. **Sum** after the condition of the continue, add the value of the "i" into a +accumulator variable called sum +4. **Print** the final value of var sum + + **Expected Output**: + 19 + + Reference loop + ```js + for (var i = 0; i <= 7; i++) {} + ``` + +### Break Exercise +1. **Sets** a variable before the loop starts (var i = 0). +2. **Sum** before the condition of the break, add the value of the "i" into a accumulator variable called sum +3. **Make** the loop break when i is 3 +4. **Print** the final value of var sum + + **Expected Output**: + 6 + + Reference loop + ```js + for (var i = 0; i <= 7; i++) {} + ``` \ No newline at end of file