We're a place where coders share, stay up-to-date and grow their careers.
A solution in Forth:
: area-or-perimeter 2dup = if * else + 2 * then ; 4 4 area-or-perimeter . 16 ok 6 10 area-or-perimeter . 32 ok
A solution in Forth: