Skip to content

[V3] Implement new Concept Exercise: For Loops #990

Closed
@junedev

Description

@junedev

Getting started

Please please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read up on the following documents:

Please also watch the following video:

See the documentation above (general documentation), as well as How to implement a Concept Exercise in JavaScript.

Goal

The goal of this exercise is to introduce for loops and the increment and decrement operator.

Concepts

The following concept pages need to be created. You can combine the two introduction.md files from the concepts and use that as introduction.md for the concept exercise. No need to create different content at this point.

  • for-loops
  • increment-decrement

Learning Objectives

In the concepts the student should learn about the following statements and operators and then practice them in the concept exercise.

  • What does a for loop do/ when is it used
  • Syntax for(...){...}
  • What is the loop counter, initialization, condition and iteration
  • How to iterate over an array with a simple for loop (more advanced ways of iterating over arrays will be introduced later)
  • What is the increment/decrement operator i++/i--

Out of Scope

  • while

Also see "About" section below for other things that should not be part of the concept introduction and the exercise.

About.md of the Concept

Here some ideas of what could be mentioned.

For Loops

  • Labels
  • break/continue
  • explain that initialization, condition and iteration are all optional

Increment/Decrement Operators

  • Talk about the return value of i++/i--
  • ++i/--i (explain the difference to i++/i--)

Prerequisites

  • arrays
  • comparison
  • conditionals

Besides these prerequisites the student only knows about basics and some primitive types. Keep that in mind when designing the exercise. See this list for details on the learning curve we are aiming for.

Exercise Idea

  • Task 4, 5 and 6 from C# Bird Watcher Exercise could be used as a template.
  • Maybe add one more task with a different iteration (e.g. every second day there was a wrong bird count, add 3 on those days and calculate total again).

Help

You can choose to do this solo-style, or collaborate with multiple people on this. The suggested approach is to

  1. First accept this issue by saying "I'd like to work on this" (you will not get a response, just go with it) and optionally request that someone works with you (and wait for a second person to accept your request).
  2. Use this issue to write down what you need (collect reference material) and discuss, if necessary, what to write and what not to write.
  3. Draft a PR and request the feedback from at least one other JavaScript member (you can ping the #maintaining-javascript channel in Slack).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions