Comparing if statement with ?: operator