Skip to content

Commit

Permalink
Implement changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dansteren committed May 19, 2022
1 parent 73e8df0 commit 564db8d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions examples/motoko_examples/factorial/src/factorial.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import {
Query,
nat
} from 'azle';
import { nat, Query } from 'azle';

// Calculate the product of all positive integers less than or equal to `n`.
export function fac(n: nat): Query<nat> {
return go(n);
return go(n);
}

// We implement the recursion in a helper function.
function go(m: nat): nat {
if(m == 0n) {
return 1n;
} else {
return m * go(m - 1n);
}
if (m == 0n) {
return 1n;
} else {
return m * go(m - 1n);
}
}

0 comments on commit 564db8d

Please sign in to comment.