Example for Python:
def factorial(n):
if n < 2:
return 1
else:
return n * factorial(n-1)
Scheme:
(define (factorial n)
(let loop ((cursor n) (product 1))
(if (<= cursor 1)
product
(loop (-1 cursor) (* product cursor)))))
Swift:
func factorial(_ n: Int) -> Int {
return (1...max(n, 1)).reduce(1, *)
}
Rakudo:
sub postfix:<!>($n: Int) {
return [*] 1 .. $n;
}
Normal fence:
factorial 0 = 1
factorial n = n * (factorial (n - 1))
Also supported is println!("inline code"), not to be confused with
the word rust followed by code (with a space in-between).