OSEmojicode.004 explains how programs repeat instructions. In Emojicode 1.0 beta 2, 🔂 iterates over a range or collection, while 🔁 repeats instructions as long as a condition remains true. The approach saves programmers from manually repeating identical statements. Readers should first review OSEmojicode.003 on conditionals, OSEmojicode.002 on variables, and OSEmojicode.001 on program structure. Each example below uses the syntax documented for the 1.0 beta 2 release.
A loop repeats a block
Emojicode encloses executable blocks between 🍇 and 🍉. A loop repeats a block rather than duplicating its individual lines in source code. The official Control Flow reference defines 🔂 as for-in, fetching values from an iterable one by one. The 🔁 construct is repeat-while, evaluating a Boolean condition before each pass. If the condition starts false, the body is skipped.
The choice depends on the task. Prefer a collection or range when a bounded group of items is already available. Use a condition-driven loop when progress depends on changing state. Either approach requires a clear stopping rule and, in real applications, appropriate resource limits.
Count with 🔂 and a numeric range
An Emojicode ⏩ range holds an immutable sequence of integers. The start value is included, while the stopping value is excluded when the step is positive. Save the following complete practice program as laps.emojic. The 🏁 symbol declares the entry point, and the inner block prints each value provided by the range.
🏁 🍇
🔂 lap 🆕⏩ 1 6❗️ 🍇
😀 🔡 lap❗️❗️
🍉
🍉
The sequence is 1, 2, 3, 4 and 5. Each integer is converted into text using 🔡 lap❗️ before printing. Expected output: five lines containing 1 through 5. The expectation was derived from the language specification, not from a completed compiler run.
A third numeric argument controls the step. For example, 🆕⏩ 0 10 2❗️ produces 0, 2, 4, 6 and 8. A negative step supports descending sequences, with the reference defining a corresponding strict stopping boundary. Learners who understand half-open intervals avoid an important source of off-by-one errors.
Visit each item in a list
A 🔂 loop can traverse a list without an explicit numeric index. Emojicode’s collection literal begins with 🍿 and ends with 🍆. The following program stores three device names, then prints the items in the sequence supplied by the collection.
🏁 🍇
🍿🔤router🔤 🔤switch🔤 🔤server🔤🍆 ➡️ devices
🔂 device devices 🍇
😀 device❗️
🍉
🍉
The loop variable device receives each string, giving three predicted lines: router, switch and server. The underlying idea is familiar across programming languages. OSGo.006 on arrays and slices offers a related comparison for learners working with indexed collections.
Repeat only while a condition is true
The 🔁 instruction accepts a Boolean condition rather than a collection. For a predictable demonstration, declare a mutable counter, print its current value and increment it each time. The official Variables and Assignment guide establishes 🖍🆕 for mutable declaration and ⬅️➕ for addition followed by assignment.
🏁 🍇
0 ➡️ 🖍🆕counter
🔁 counter ◀️ 3 🍇
😀 🔡 counter❗️❗️
counter ⬅️➕ 1
🍉
🍉
The initial value is zero. The comparison counter ◀️ 3 stays true for 0, 1 and 2. Once the counter becomes 3, the next test is false, ending the loop. Expected output: 0, 1 and 2, on separate lines. Removing the increment would leave the condition true and produce an unbounded stream of zeroes until the program is interrupted. Zero-iteration cases are also important: changing the comparison limit to zero would skip the loop entirely.
Compile and check actual output
Install the 1.0 beta 2 compiler and a supported C++ compiler and linker according to the Emojicode installation guide. Use a UTF-8 text editor and save one complete sample per file. The official compile-and-run tutorial documents the basic shell workflow. For the first program, a Unix-like terminal uses:
emojicodec laps.emojic
./laps
Check the executable name reported by your toolchain, especially on Windows. Record compiler version, output and errors, then compare them against the manual traces. A source example that looks valid is not equivalent to a passed runtime test. The editorial environment did not have an Emojicode compiler installed, so no compilation or execution is being claimed.
Practice exercises and engineering limits
Try three changes. Set the range to 🆕⏩ 2 12 3❗️ and predict 2, 5, 8 and 11. Add 🔤firewall🔤 to the device list and expect four printed names. Change the repeat-while limit from 3 to 0 and predict no output. Learners can verify the resulting behavior, then explain any difference between expected and observed values.
The same concepts apply to equipment inventories, batch jobs, metrics collection and network automation, but classroom code is not a production monitoring system. Use authorized data sources, finite bounds, error handling and resource limits before running operational scripts. For another compiled language comparison, consult OSZig.003 on control flow.
Conclusion: Prefer 🔂 for iteration over known ranges and collections. Use 🔁 when a changing condition controls repetition. Predict each pass, identify a terminating condition and verify results through a real compiler whenever available.
Editor’s Note: The lesson advances the verified OSEmojicode.003 curriculum and uses official Emojicode 1.0 beta 2 reference material. Program outputs are manually traced expectations, not evidence of compiler execution. Three public video identities were checked, but actual YouTube playback and mobile-layout rendering were not independently tested. The original 1200 × 630 photorealistic cover is conceptual editorial artwork, not a screenshot of running Emojicode.

BitcoinVersus.Tech is volunteer-run and publishes independent technical education. An optional 5,000-satoshi donation supports research. Scan the original QR from a second screen with a compatible Bitcoin wallet, or import a saved QR image where supported. Independently verify recipient 3C9o19EH5HSiwEPyCTmEKzxhNCbo2X6TTb and amount before sending. Bitcoin transfers are generally irreversible.
We volunteer daily to ensure the credibility of information on BitcoinVersus.Tech is Verifiably True. The lesson is educational and informational, not authorization to modify production networks, licensed engineering advice, financial advice or investment advice.

Leave a Reply