view src/ploki/examples/fac.pk @ 5983:e9e46956a506

<oerjan> mk wisdom/welcome.sv//Hej och v\xc3\xa4lkommen till den internationella knutpunkten f\xc3\xb6r esoterisk programmeringsspr\xc3\xa5ksdesign och -drifts\xc3\xa4ttning! F\xc3\xb6r mer information, se v\xc3\xa5r wiki: <http://esolangs.org/>. (F\xc3\xb6r den andra sortens esoterism, pr\xc3\xb6va #esoteric p\xc3\xa5 EFnet eller DALnet.)
author HackBot
date Mon, 14 Sep 2015 17:49:06 +0000
parents ac0403686959
children
line wrap: on
line source

"calculate the faculty of [1..8]: "ß{
REM faculty program in false and ploki
REM Lukas Mai, 11.09.2003
REM} [$1=$[\%1\]?~[$1-f;!*]?]f: ^'0-$$0>~\8>|$ {
LET n @LEGS(\EING)
REM}
"result: "ß{
IF n < 1 | (n > 8)
  REM} ~[\f;!.]?[
  "illegal input"ß{
ELSE
  LET f 1
  FOR loop IF n > 0
    LET f f * n
    LET n n - 1
    NEXT loop
  FI
  WUNT f
FI
REM} ]?"
"