mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Merged with upstream. Updated M (aka MUMPS) detection to use the new bayesian / samples method.
This commit is contained in:
19
samples/M/functions.m
Normal file
19
samples/M/functions.m
Normal file
@@ -0,0 +1,19 @@
|
||||
; This function computes a factorial
|
||||
|
||||
|
||||
factorial(n) ;;
|
||||
new f
|
||||
set f=n
|
||||
for do quit:n'>1
|
||||
. set n=n-1
|
||||
. set f=f*n
|
||||
. write n," : ",f,!
|
||||
quit f
|
||||
|
||||
|
||||
|
||||
main() ;;
|
||||
set x=5
|
||||
set y=$$factorial(x)
|
||||
write "Factorial of ",x," = ",y,!
|
||||
quit
|
||||
Reference in New Issue
Block a user