Skip to content

Expand iteration module content with detailed explanation Addresses …#1711

Open
saikrishna488 wants to merge 1 commit intoCodeYourFuture:mainfrom
saikrishna488:patch-2
Open

Expand iteration module content with detailed explanation Addresses …#1711
saikrishna488 wants to merge 1 commit intoCodeYourFuture:mainfrom
saikrishna488:patch-2

Conversation

@saikrishna488
Copy link

@saikrishna488 saikrishna488 commented Jan 20, 2026

…issue #1706: Expand description of array iteration Adds comprehensive content including: - Introduction to iteration as a general programming concept - Detailed explanation of the 'for' loop syntax and execution - Information about alternative loop types - Real-world examples and use cases

Added comprehensive overview of iteration, including definitions, examples, and various loop types in JavaScript.

What does this change?

Common Content?

  • Block/s

Common Theme?

  • Yes

Issue number: #issue-number

Org Content?

Module | Sprint | Page Type | Block Type

Checklist

Who needs to know about this?

…ssue CodeYourFuture#1706: Expand description of array iteration  Adds comprehensive content including: - Introduction to iteration as a general programming concept - Detailed explanation of the 'for' loop syntax and execution - Information about alternative loop types - Real-world examples and use cases

Added comprehensive overview of iteration, including definitions, examples, and various loop types in JavaScript.
@netlify
Copy link

netlify bot commented Jan 20, 2026

👷 Deploy request for cyf-curriculum pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2570b0c

@netlify
Copy link

netlify bot commented Jan 20, 2026

👷 Deploy request for cyf-piscine pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2570b0c

@netlify
Copy link

netlify bot commented Jan 20, 2026

👷 Deploy request for cyf-common pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2570b0c

@netlify
Copy link

netlify bot commented Jan 20, 2026

👷 Deploy request for cyf-sdc pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2570b0c

@netlify
Copy link

netlify bot commented Jan 20, 2026

👷 Deploy request for cyf-itd pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2570b0c

@netlify
Copy link

netlify bot commented Jan 20, 2026

👷 Deploy request for cyf-tracks pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2570b0c

@netlify
Copy link

netlify bot commented Jan 20, 2026

👷 Deploy request for cyf-launch pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 2570b0c

@Poonam-raj Poonam-raj self-requested a review January 20, 2026 15:26
Copy link
Contributor

@Poonam-raj Poonam-raj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sai, thank you for your contribution, really nicely expanded on.

Some comments left about bits that just need signposting, deleting or rewording now we have this additional section.
Plus the code snippets could do with a comment in them to show output just to increase clarity to students.

Thanks!

1. Initialize the counter variable (happens once)
2. Check the condition
3. If the condition is true, execute the code in the loop body
4. Execute the increment/update statement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just refer to "increment statement" on point 4 to avoid confusion

Comment on lines +96 to +102
```javascript
let i = 0;
while (i < 5) {
console.log(i);
i++;
}
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add in a commented indicator of what the log will output? Again just do this for the rest of the code snippets included here

Just so students can immediately see the result of the loop

Comment on lines +79 to +83
```javascript
const numbers = [10, 20, 30];
for (const number of numbers) {
console.log(number);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add in a commented indicator of what the log will output?

Comment on lines +67 to +70
```javascript
for (let i = 0; i < 3; i++) {
console.log(i);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add in a commented indicator of what the log will output?

Comment on lines +120 to +132
### The `for...in` Loop

The `for...in` loop iterates over the properties of an object (including inherited ones):

```javascript
const person = { name: 'Alice', age: 30, city: 'London' };
for (const key in person) {
console.log(key + ': ' + person[key]);
}
```

**Note:** For arrays, use `for...of` instead of `for...in`, as `for...in` includes inherited properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the compehensiveness of including for...in but in this case as objects haven't been touched on yet for students I think avoiding confusion and not introducing object syntax too soon will be helpful. Please remove for...in from this page.

Ideally we would have a section in sprint 2 of this module (where objects is interested) where we discuss iteration again but in the context of a for...in loop.

Iteration is a universal programming concept that you'll use constantly. Start by mastering the `for` and `for...of` loops, as these are the most common and fundamental. As you progress, you'll learn when and how to use the other loop types and array methods, each suited to different situations and coding styles.


To solve the sub-goal, we have to repeatedly add each number in the array to the `total`, one at a time. In programming, the process of repeating something is called **iteration**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a subheading to indicate we're back into solving the sub-goal. "Continuing with CalculateMean" or "Solving the sub-goal" or similar.

Comment on lines 161 to 163
In programming, we can **iterate** by using a {{<tooltip title="loop">}}A loop is a sequence of instructions that is continually repeated until some condition is reached.{{</tooltip>}}.

In particular, we can use a [`for...of` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) to sum the elements of the array.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-work this wording, now we have explained iteration this feels a bit janky and needs to flow on better from your addition above.

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🔖 Ready in Curriculum Planning Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔖 Ready

Development

Successfully merging this pull request may close these issues.

2 participants