Visual illustration of the code challenge: Boucle foreach

Boucle foreach

On parcourt un tableau contenant des entiers.

Coding in the sandbox You must be logged in to access the sandbox.

Données

  • values est un tableau qui contient une vingtaine de valeurs entières comprises entre 1 et 10

Réponse attendue

Tu dois retourner la somme des valeurs supérieures ou égales à 5 comprises dans values.

Par exemple, si values contient [1, 3, 4, 8, 6, 2, 5] il faut retourner 8 + 6 + 5 = 19.

Solve the challenge

To code this challenge, several possibilities:
- Want to start coding right away? Use the online Sandbox.
- Want to work in your favorite editor? Organize your code well, test, check out our API documentation.
- You can also copy/paste a dataset below.

challenge code for resolution via API: STARTER_5

Some resources to help you:
Data and algorithmic logic Methodologies Corrections

Support for resolution

Progress through challenges using our resolution aids: tools, techniques and advice to help you overcome the most complex programming challenges with methodology, confidence and creativity.

Dataset and algorithmic logic

Based on the data and the expected response, use the process to determine the logic to implement.

Show data and progress

Methodologies

Develop a structured approach with our solving guides. Work on specific concepts such as object-oriented programming or unit testing to improve your coding style and progress.

No methodology yet for this challenge, but we are working on it! Follow us to be informed of the release!


Corrections

The corrections allow you to discover certain technical concepts but will also give you a solution to the challenge. Code the challenge yourself before consulting the corrections ;)

No answer yet for this challenge, but we&'re working on it! Follow us to be informed of the release!

Keep coding

Other challenges to complete

Beginner
Les plaques d’immatriculation #1

Les plaques d’immatriculation #1

Enfant, on passait le temps dans la voiture en observant les plaques d’immatriculation. Et si on codait tout ça ?

Behavioral
Intermediate
WALL-E #4 : un peu de rangement

WALL-E #4 : un peu de rangement

Wall-E s’ennuie un peu et décide de ranger tous les blocs de déchets qu’il a construit.

Behavioral
Beginner
Greenoïd #1 - An unexpected encounter

Greenoïd #1 - An unexpected encounter

With your friends Hazel and Ash, you happen to come across an old robot…
Behavioral Corrigé disponible : PHP