Yes.
A two-way decision (alternation) is written in assembly language using both a conditional branch and a jump instruction. Look at this example carefully! It shows how a basic control structure is built out of small assembly instructions.
... # load values into # $8 and $9 beq $8,$9,equal # branch if equal sll $0,$0,0 # branch delay slot ... # ... # false branch ... # j cont sll $0,$0,0 # branch delay slot equal: ... # ... # true branch ... # cont: add $10,$10,$11 # always executed
Of course, any of the conditional branch instructions may
be used in the place of beq
.
If you want the "true" branch to come first and the "false"
branch to come second
(as in an if-then-else of Java or C),
pick a different branch instruction.
In an if-then-else structure, the two branches of control
always come together at the first statement outside of the structure
(the statement at cont
(continue) in the example).
Is this necessarily so in assembly language?