mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-06 14:56:54 +02:00
Fix off-by-one error
Iterate from 0..9, i.e. while $t0 is < 10
This commit is contained in:
@@ -213,8 +213,9 @@ gateways and routers.
|
|||||||
# instruction to continue its execution
|
# instruction to continue its execution
|
||||||
li $t0, 0
|
li $t0, 0
|
||||||
while:
|
while:
|
||||||
bgt $t0, 10, end_while # While $t0 is less than 10,
|
bgt $t0, 9, end_while # While $t0 is less than 10,
|
||||||
# keep iterating
|
# keep iterating
|
||||||
|
#actual loop content would go here
|
||||||
addi $t0, $t0, 1 # Increment the value
|
addi $t0, $t0, 1 # Increment the value
|
||||||
j while # Jump back to the beginning of
|
j while # Jump back to the beginning of
|
||||||
# the loop
|
# the loop
|
||||||
|
Reference in New Issue
Block a user