chap 2.5.0

Chap is an easy to learn, interpretive, scripting language written in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::builtin_function::control_flow::jump::jump;
use crate::common::errors::Result;
use crate::runtime::Runtime;
use crate::{builtin_function::utils::param_to_datatype, common::executable::ExecutableLine};

pub fn jump_if_not_equal(runtime: &mut Runtime, executable: &ExecutableLine) -> Result<()> {
    let p1 = param_to_datatype(runtime, executable.params.get(1), executable.line_number)?;
    let p2 = param_to_datatype(runtime, executable.params.get(2), executable.line_number)?;

    if p1 != p2 {
        // Datatype implements PartialEq
        jump(runtime, executable)?;
    }

    Ok(())
}