Skip to content

Commit

Permalink
factorail code added
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryptonean committed Sep 16, 2024
1 parent fdb9a85 commit f40cc60
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions validators/factorail.ak
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

fn factorail_1(x: Int) -> Int {
when x is {
0 || 1-> 1
_ -> x * factorail_1(x - 1)
}
}

test factorial_test() {
let result = factorail_1(3)
if result != 6 {
fail
} else {
True
}
}

test factorial_test1() {
let result = factorail_1(3)
expect result == 6
}


0 comments on commit f40cc60

Please sign in to comment.