kaede 0.1.2

Kaede adalah rust library untuk operasi matematika sederhana.
Documentation
1
2
3
4
5
6
7
8
9
use crate::MathError;

pub fn faktorial(angka: i32) -> Result<i32, MathError> {
    if angka < 0 {
        Err(MathError::TipeError("bilangan non-negatif".to_string()))
    } else {
        Ok((1..=angka).product())
    }
}