Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
morelisp
on Dec 13, 2020
|
parent
|
context
|
favorite
| on:
If-then-else had to be invented
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: