Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- if statements allow developers branch code, executing code only if a condition is true.
- */
- int number = 5;
- if(number < 10) {
- // execute code
- }
- /**
- if else statements allow you to execute code if the condition is not true.
- */
- if(number < 10) {
- // execute if true
- } else {
- // execute if false
- }
- /**
- You can combine conditions using && and ||.
- && represents AND.
- Both conditions must be true for the code to execute.
- */
- // if (number < 10 AND number > 0)
- if(number < 10 && number > 0) {
- }
- /**
- || represents OR.
- Only one condition must be true for the code to execute.
- */
- // if (number < 10 OR number > 0)
- if(number < 10 || number > 0) {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement