Exercise: Foreach
Test your understanding of the foreach statement with this exercise.
To complete the exercises in this lesson, we require a review of the arrays and lists we learned earlier in this course. This knowledge will equip us with the tools to effectively solve the following exercises: calculating squares of numbers in a list and summing even numbers in an array, reinforcing our understanding of the foreach loops through practical application.
Exercise 1: Square numbers with the foreach loop
Problem statement
Write a foreach loop that outputs the ...
 Ask