---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 26 Edition"
java_version: 26
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.if_cond"
heading: "if<cond>"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se26/html/jvms-6.html#jvms-6.5.if_cond
id: "6.5.if_cond"
url: https://jvm.obfuscated.software/jvms/se26/6.5.if_cond.html
raw: https://jvm.obfuscated.software/jvms/se26/6.5.if_cond.md
---

# if\<cond>

## Operation

Branch if `int` comparison with zero succeeds

## Format

```
if<cond>
branchbyte1
branchbyte2
```

## Forms

*ifeq* = 153 (0x99)

*ifne* = 154 (0x9a)

*iflt* = 155 (0x9b)

*ifge* = 156 (0x9c)

*ifgt* = 157 (0x9d)

*ifle* = 158 (0x9e)

## Operand Stack

..., *value* →

...

## Description

The *value* must be of type `int`. It is popped from the operand stack and compared against zero. All comparisons are signed. The results of the comparisons are as follows:

- *ifeq* succeeds if and only if *value* = 0
- *ifne* succeeds if and only if *value* ≠ 0
- *iflt* succeeds if and only if *value* < 0
- *ifle* succeeds if and only if *value* ≤ 0
- *ifgt* succeeds if and only if *value* > 0
- *ifge* succeeds if and only if *value* ≥ 0

If the comparison succeeds, the unsigned *branchbyte1* and *branchbyte2* are used to construct a signed 16-bit offset, where the offset is calculated to be (*branchbyte1* `<<` 8) | *branchbyte2*. Execution then proceeds at that offset from the address of the opcode of this *if\<cond>* instruction. The target address must be that of an opcode of an instruction within the method that contains this *if\<cond>* instruction.

Otherwise, execution proceeds at the address of the instruction following this *if\<cond>* instruction.
