๐Ÿ”‚ For In

christian.dinh's avatar
Published Aug 4, 2021Updated Sep 9, 2021
Contribute to Docs

The ๐Ÿ”‚ statement allows you to quickly iterate over an instance, that is repeatedly retrieving values from it until there are no more values to provide.

For example, you can iterate over an ๐Ÿจ instance and youโ€™ll receive all elements contained in the list.

Syntax

๐Ÿ ๐Ÿ‡
๐Ÿฟ ๐Ÿ”คcookies๐Ÿ”ค ๐Ÿ”คmilk๐Ÿ”ค ๐Ÿ”คeggs๐Ÿ”ค ๐Ÿ”คblueberries๐Ÿ”ค ๐Ÿ† โžก๏ธ grocery
๐Ÿ”‚ item grocery ๐Ÿ‡
๐Ÿ˜€ itemโ—๏ธ
๐Ÿ‰
๐Ÿ‰

The output would be:

cookies
milk
eggs
blueberries

In this example, the code block will be repeated for every value of the list and the values are printed. The type of item is naturally ๐Ÿ”ก.

All contributors

Contribute to Docs

Learn Emojicode on Codecademy