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

{{WebAssemblySidebar}}

The sub instructions, short for subtraction, are used for subtracting one number from another number, similar to the - operator in other languages.

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

Syntax

;; load two numbers onto the stack i32.const 10 i32.const 3 ;; subtract one number from the other i32.sub ;; the top item on the stack will now be 7 (10 - 3 = 7)
InstructionBinary opcode
i32.sub0x6b
i64.sub0x7d
f32.sub0x93
f64.sub0xa1