quilt_lang/condition.rs
1#[derive(Debug)]
2pub enum Condition {
3 Equal,
4 NotEqual,
5 Less,
6 LessEqual,
7 Greater,
8 GreaterEqual,
9}
10
11impl Condition {
12 pub fn compare(&self, x: i64) -> bool {
13 match self {
14 Self::Equal => x == 0,
15 Self::NotEqual => x != 0,
16 Self::Less => x < 0,
17 Self::LessEqual => x <= 0,
18 Self::Greater => x > 0,
19 Self::GreaterEqual => x >= 0,
20 }
21 }
22}