patternMinor
PLZ HELP MEH IMPROVA MEH LOLCAT CODEZ, WHUCH CALCULUTS FAWCTORIALS
Viewed 0 times
fawctorialslolcathelpcalculutsmehcodezplzwhuchimprova
Problem
SUNCE MEH BEEN WRUTEN CODEZ IN MUNY DIFFRNT PROGRAMMING LANGUAGES, MEH THOUGHTZ THAT ME TRY TO WRITE CODEZ IN AN ESOTERIC LANGUAGE. MEH CODEZ CALCULUTS A FAWCTORIAL OF UH USR INPUTTED NUMBAH IN LOLCODE, LOL.
SOME OF MEH QUSTIONS:
TRANSLATION:
Since I've been writing and trying programs in many different languages, I thought I'd give esoteric language a crack. So I used LOLCODE to write a program that calculates the factorial of a user given number:
Questions for consideration:
LOLCAT.lol
For those of you who are not fortunate enough to have a LOLCODE compiler, here is a link to a REPL.IT of the code.
NOTE: All answer must be given in proper LOLCODE English, with an optional translation in regular English. Failure to do so will result in me releasing my LOLCATS upon you....
SOME OF MEH QUSTIONS:
- IZ MEH CODEZS A IDMITIC LOLCAT PROGUM?
- IZ THERE A GOODER WAY OF WRUTING MEH
factorialFUNCSHUNS?
TRANSLATION:
Since I've been writing and trying programs in many different languages, I thought I'd give esoteric language a crack. So I used LOLCODE to write a program that calculates the factorial of a user given number:
Questions for consideration:
- Is my LOLCODE code idiomatic to the LOLCODE language?
- Is there a easier way to write my
factorialfunction?
LOLCAT.lol
BTW Calculates the factorial for a user given integer
BTW Author: Pythonic
BTW Version: 1.0
HAI 1.2
HOW DUZ I factorial YR n
BOTH SAEM n AN 0, O RLY?
YA RLY
FOUND YR 1
NO WAI
FOUND YR PRODUKT OF n AN factorial DIFF OF n AN 1
OIC
IF U SAY SO
HOW DUZ I main
I HAS A user_input
VISIBLE "ENTER AN NUMBAH"
VISIBLE "TO FINDZ ITZ FAWCTORIAL:: "
GIMMEH user_input
VISIBLE "DE FAWCTORIAL OF " user_input " IZ:: " factorial user_input
VISIBLE "KTHXBYE!"
IF U SAY SO
main
KTHXBYEFor those of you who are not fortunate enough to have a LOLCODE compiler, here is a link to a REPL.IT of the code.
NOTE: All answer must be given in proper LOLCODE English, with an optional translation in regular English. Failure to do so will result in me releasing my LOLCATS upon you....
Solution
Your factorial function enters an infinite loop if passed a negative integer. Since the entire program seems to take 1 input and then exit, I think it would be best if the program gave an error message and then exited.
Context
StackExchange Code Review Q#144192, answer score: 8
Revisions (0)
No revisions yet.