Jump to content

Conditional structures: Difference between revisions

fix z80 sections to not clutter table of content
m (→‎if-else: make a sub-section of blz)
(fix z80 sections to not clutter table of content)
Line 7,944:
The compare instruction is often used in combination with jumps, calls, and returns to implement high-level control structures.
 
===If-Then-Else===
We'll look at this example in C and in Z80 Assembly:
 
Line 7,986:
If the accumulator didn't equal 20, no <code>CALL</code> will actually take place.
 
===Switch===
Switch cases can be implemented in a few ways. The simplest way is by checking each value individually.
<lang Z80>ld a,(HL) ;switch (HL)
37

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.