This blog continues our series of C# coding brainteasers, which teach you how to read code without compiling it. This blog will provide 6 puzzles on IF statements. The puzzles will help you learn practical programming skills.
This is how an IF statement works. An IF statement runs code based on a test. This test results in true or false. When it results in true on or more statements run. Optionally alternative statements can run if the test results in false. IF statements are also called conditional statements, since code is executed based on value of the condition (test). IF statements are frequently used in all levels of programming.
Try to solve these 6 IF statements with your C# or other coding knowledge. Just predict the output without executing the code. If you need some help, check our C# course. Write your answer in the comments below. Or add your own puzzle.
1).
2).
3).
4).
5).
6).
Write your answers in the comments below and Share it. If you struggle just ask questions bellow and we will help you.