private static Value Modulo <T>(FlowController flow, IntegerDivisorModulo <T> operation, T dividend, double divisor) { int convertedValue; // Here we distinguish whether the integer divisor is known or not if (TypeConversion.TryConvertToInteger(divisor, out convertedValue)) { return(operation(flow, dividend, convertedValue)); } else { return(WarnPossibleModuloByZero(flow)); } }
private static Value Modulo <T>(FlowController flow, IntegerDivisorModulo <T> operation, T dividend, string divisor) { int integerValue; double floatValue; bool isInteger; TypeConversion.TryConvertToNumber(divisor, false, out integerValue, out floatValue, out isInteger); // Here we distinguish whether the integer divisor is known or not if (isInteger) { return(operation(flow, dividend, integerValue)); } else { return(WarnPossibleModuloByZero(flow)); } }