title: If else in MIPS
body: <p>I am learning MIPS programming, in which I am trying to implement If else conditions. But the problem is when I enter 2 to select subtract condition, the program doesn't work. I know could have used BNE but I want to learn BEQ. Please tell me what is the problem is this code</p>
  
  <pre><code>.text
  
  main:
  
  li $t0,1
  li $t1,2
  li $t2,3
  li $t3,4
  
  li $v0,5
  syscall
  
  move $s0,$v0
  
  beq $s0,$t0,ADDTN
  ADDTN:
  
  
  li $a0,40
  li $v0,1
  syscall
  
  li $v0,5
  syscall
  
  
  move $s1,$v0
  
  li $v0,5
  syscall
  
  move $s2,$v0
  
  add $a0,$s1,$s2
  
  li $v0,1
  syscall
  
  li $v0,10
  syscall
  
  
  
  beq $s0,$t1,SUBTN
  SUBTN:
  
  li $a0,50
  li $v0,1
  syscall
  
  li $v0,5
  syscall
  
  
  move $s3,$v0
  
  li $v0,5
  syscall
  
  move $s4,$v0
  
  sub $a0,$s3,$s4
  
  li $v0,1
  syscall
  
  li $v0,10
  syscall
  </code></pre>