X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=adoc%2Fp_break.adoc;h=dec6fd78242b901701eed5156ab84f033cd1fe7e;hb=9b8fcf87eaed58b6dfabcf885f8eef5484643de6;hp=f7da196579288ed75bcf2696fc105735941730c1;hpb=241c3dd0c465fb45a6ab240aa088268b8743cff4;p=rrq%2Frrqforth.git diff --git a/adoc/p_break.adoc b/adoc/p_break.adoc index f7da196..dec6fd7 100644 --- a/adoc/p_break.adoc +++ b/adoc/p_break.adoc @@ -9,3 +9,24 @@ branch out of an enclosing xef:p_begin[BEGIN]-xref:p_end[END] block. Similar to xref:p_ifbreak[IFBREAK] it lays out the branch cell followed by a reserved cell for the branch offset, and inserts the resolution address just above the required 0 on the data stack. + +==== +.Usage example {counter:example}: unconditional break with a condition. +---- +: WTELL ( tfa -- ; Print word pname ) + 24 + DUP 8 + SWAP @ TELL SP EMIT +; + +: WORDS ( wordlist -- ; Print all words of word list ) + BEGIN + @ DUP IF DUP WTELL ELSE BREAK THEN + END + DROP + NL EMIT +; +---- +==== + +See also <>, <>, +<>, <>, <>, +<> and <>.