|
|
|
|
|
by jftuga
717 days ago
|
|
This reminds me of some silly C code I once wrote for fun, which counts down from 10 to 1: #include <stdio.h> // compile & run: gcc -Wall countdown.c -o countdown && ./countdown
int n = 10; int main(int argc, char *argv[]) { printf("%d\n", n) && --n && main(n, NULL); }
Python version: import sys # run: python3 countdown.py 10
def main(n:int): sys.stdout.write(f"{n}\n") and n-1 and main(n-1)
main(int(sys.argv[1]))
Shell version: # run ./countdown.sh 10
echo $1 && (($1-1)) && $0 $(($1-1))
|
|