public static Value ifFunction(final ValueList values) {
        values.assertCheckCount(0, -1, false);
        final int ifConditionCount = values.size() / 2;
        final boolean hasElse = values.size() % 2 == 1;
        for (int i = 0; i < ifConditionCount; i++) {
            if (values.get(i * 2).getAsBoolean()) {
                return values.get(i * 2 + 1);
            }
        }
        return hasElse ? values.get(values.size() - 1) : Value.of(0);
    }
Holds implementations for functions in Formula
main/src/main/java/cgeo/geocaching/utils/formulas/FormulaUtils.java