implement if function without optimized