mirror of
https://github.com/bitcoinbook/bitcoinbook
synced 2024-11-26 09:58:22 +00:00
Edited ch07.asciidoc with Atlas code editor
This commit is contained in:
parent
22f6661ecb
commit
e6630726d3
@ -427,7 +427,7 @@ When reading Bitcoin Script, remember that the condition being evaluated comes _
|
||||
|
||||
==== Conditional Clauses with VERIFY Opcodes
|
||||
|
||||
((("VERIFY opcodes")))((("IF clauses")))Another form of conditional in Bitcoin Script is any opcode that ends in +VERIFY+. The +VERIFY+ suffix means that if the condition evaluated is not +TRUE+, execution of the script terminates immediately and the transaction is deemed invalid.
|
||||
((("VERIFY opcodes")))((("IF clauses")))((("opcodes", "VERIFY")))Another form of conditional in Bitcoin Script is any opcode that ends in +VERIFY+. The +VERIFY+ suffix means that if the condition evaluated is not +TRUE+, execution of the script terminates immediately and the transaction is deemed invalid.
|
||||
|
||||
((("guard clauses")))Unlike an +IF+ clause, which offers alternative execution paths, the +VERIFY+ suffix acts as a _guard clause_, continuing only if a precondition is met.
|
||||
|
||||
@ -470,7 +470,7 @@ So, when do we use +VERIFY+ and when do we use +IF+? If all we are trying to do
|
||||
|
||||
[TIP]
|
||||
====
|
||||
An opcode such as +EQUAL+ will push the result (+TRUE+/+FALSE+) onto the stack, leaving it there for evaluation by subsequent opcodes. In contrast, the opcode +EQUALVERIFY+ suffix does not leave anything on the stack. Opcodes that end in +VERIFY+ do not leave the result on the stack.
|
||||
((("EQUAL opcodes")))((("opcodes", "EQUAL")))((("EQUALVERIFY opcode")))((("opcodes", "EQUALVERIFY")))An opcode such as +EQUAL+ will push the result (+TRUE+/+FALSE+) onto the stack, leaving it there for evaluation by subsequent opcodes. In contrast, the opcode +EQUALVERIFY+ suffix does not leave anything on the stack. Opcodes that end in +VERIFY+ do not leave the result on the stack.
|
||||
====
|
||||
|
||||
==== Using Flow Control in Scripts
|
||||
|
Loading…
Reference in New Issue
Block a user