Skip to content

Add exercise questions for continue & break #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/Exercise/JavaScript_Basics/continue_break.md
Original file line number Diff line number Diff line change
@@ -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++) {}
```