Empty string: Difference between revisions

Content added Content deleted
Line 137: Line 137:
Strings are represented as an addr-len pair on the stack. An empty string has len 0.
Strings are represented as an addr-len pair on the stack. An empty string has len 0.


<lang forth>: empty? ( str len -- ? ) nip 0= ;
<lang forth>: empty? ( c-addr u -- ? ) nip 0= ;


s" " dup . empty? . \ 0 -1</forth>
s" " dup . empty? . \ 0 -1</lang>


=={{header|Go}}==
=={{header|Go}}==