Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, Forth is stack-based RPN so "IF" naturally comes after the test; "THEN" marks the end of the block; so if you want "ELSE" it ends up in the middle to let you nest conditions.

    : /CHECK   DUP 0= IF  ." invalid " DROP  ELSE  /  THEN ;
https://www.forth.com/starting-forth/4-conditional-if-then-s...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: