How to compare a string to a string in Forth? -


how compare 2 strings in forth?

and can in if statement or should make helper boolean variable? here's code have far. way, iox@ input user.

: var compile: variable complile: ;  : lock compile: var realpass$ compile: realpass$ "password" ! compile: ." enter password: " compile: var pass$ compile: iox@ pass$ ! compile: var match compile: realpass$=pass$ match ! unknown token: realpass$=pass$ 

the ansi word compare strings compare (c-addr_1 u_1 c-addr_2 u_2 -- n). n equals 0 if 2 strings compared equal. forth eschews explicit variables in favor of using stack using if directly without variable fine.

: pwcheck   compare   if ." entry denied."   else ." welcome friend."   cr ;  s" hello" ok s" goodbye" ok pwcheck not wanted here. ok s" howdy"  ok s" howdy"  ok pwcheck welcome friend. ok 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -