Advanced · Lesson 12 of 12

A first algorithm

An algorithm is a repeatable procedure for solving a problem. Counting values is one example: begin with zero, inspect each item, and update the count when it matches. Check the empty collection and a collection with no matches.

Try it for yourself

Run the example, then change one thing and see what happens.

13px
main.jsYour ideas, in code.
Loading your editor…
Run your code to see the output here.
Ready to buildUTF-83 lines

Expected output

3

Make it your own

Change the numbers and predict how many even values remain.

A quick check

Which habit helps when learning a first algorithm?