corrected syntax with if-else expression