pub fn compare_values(vm: &mut Vm, a: &Value, b: &Value) -> Result<Ordering, RuntimeError> {
    match vm.run_binary_op(BinaryOp::Less, a.clone(), b.clone())? {
        Value::Bool(true) => Ok(Ordering::Less),
        Value::Bool(false) => match vm.run_binary_op(BinaryOp::Greater, a.clone(), b.clone())? {
            Value::Bool(true) => Ok(Ordering::Greater),
            Value::Bool(false) => Ok(Ordering::Equal),
            unexpected => runtime_error!(
                "Expected Bool from > comparison, found '{}'",
                unexpected.type_as_string()
            ),
        },
        unexpected => {
            runtime_error!(
                "Expected Bool from < comparison, found '{}'",
                unexpected.type_as_string()
            )
        }
    }
}
/// Compares values using Koto operators.
Compares values using Koto operators.
Compares values using Koto operators .
pub fn compare_values(vm: &mut Vm, a: &Value, b: &Value) -> Result<Ordering, RuntimeError> {
    match vm.run_binary_op(BinaryOp::Less, a.clone(), b.clone())? {
        Value::Bool(true) => Ok(Ordering::Less),
        Value::Bool(false) => match vm.run_binary_op(BinaryOp::Greater, a.clone(), b.clone())? {
            Value::Bool(true) => Ok(Ordering::Greater),
            Value::Bool(false) => Ok(Ordering::Equal),
            unexpected => runtime_error!(
                "Expected Bool from > comparison, found '{}'",
                unexpected.type_as_string()
            ),
        },
        unexpected => {
            runtime_error!(
                "Expected Bool from < comparison, found '{}'",
                unexpected.type_as_string()
            )
        }
    }
}
pub fn compare_values ( vm : & mut Vm , a : & Value , b : & Value ) -> Result < Ordering , RuntimeError > { match vm . run_binary_op ( BinaryOp :: Less , a . clone ( ) , b . clone ( ) ) ? { Value :: Bool ( true ) => Ok ( Ordering :: Less ) , Value :: Bool ( false ) => match vm . run_binary_op ( BinaryOp :: Greater , a . clone ( ) , b . clone ( ) ) ? { Value :: Bool ( true ) => Ok ( Ordering :: Greater ) , Value :: Bool ( false ) => Ok ( Ordering :: Equal ) , unexpected => runtime_error ! ( " " unexpected type_as_string ( ) ) , } , unexpected => { runtime_error ! ( " " unexpected type_as_string ( ) ) } } }
Compares values using Koto operators.
Compares values using Koto operators .
vm
&mut Vm
a
&Value
b
&Value
vm
&mut Vm
a
&Value
b
&Value