mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-13 15:38:06 -05:00
14 lines
266 B
Plaintext
14 lines
266 B
Plaintext
@main = function() {
|
|
call @factorial [5] %return
|
|
}
|
|
@factorial = function(%n) {
|
|
op!== %n 0 %notZero
|
|
jmpif %notZero :recurse
|
|
mov 1 %return
|
|
end
|
|
recurse:
|
|
op- %n 1 %nMinus1
|
|
call @factorial [%nMinus1] %previousFactorial
|
|
op* %n %previousFactorial %return
|
|
}
|