Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/webassembly/reference/numeric/equal/index.md
6508 views
---
title: Equal slug: WebAssembly/Reference/Numeric/Equal
---

{{WebAssemblySidebar}}

The eq instructions, short for equal, check if two numbers are equal. If both numbers are equal 1 will be pushed on to the stack, otherwise 0 will be pushed on to the stack.

Similarly, the eqz instructions check if a number is equal to zero, the eqz instructions are only available for the integer types and not for the floating point types.

{{EmbedInteractiveExample("pages/wat/eq.html", "tabbed-taller")}}

Syntax

;; load 2 numbers on to the stack local.get $num i32.const 2 ;; check if $num is equal to '2' i32.eq ;; if $num is equal to `2`, `1` will be pushed on to the stack, ;; otherwise `0` will be pushed on to the stack.
InstructionBinary opcode
i32.eqz0x45
i32.eq0x46
i64.eqz0x50
i64.eq0x51
f32.eq0x5b
f64.eq0x61