Академический Документы
Профессиональный Документы
Культура Документы
Condition 1
Implementing Condition
1
If
Condition 1
is TRUE
If
Condition 1
is FALSE
Definition: Boolean is a data type of java with only 2 possible outcome. True or False. Boolean
is named after a renowned scientist George Boole.
Why Is Boolean Used? Boolean is used to determine whether a given condition matches to the
present condition. For example, if a news reporter says about the high chances of rain on a
particular day; if it rains on that particular day then his forecast turns out true and if it does not
rain, his forecast turns to be false. So similarly, Boolean is used to create a decision among
situation.
How Does Boolean Work? Boolean works on the basis of expected result and actual result. If
the expected results are equal to actual result then the program will choose to continue on
alternative 1. But if the results differ, then it works on alternative 2. Hence, there will always be
2 distinct outcomes for Boolean. One of which results when results are equal and the other when
the results differ.
How to use Boolean while programming? It is very simple to use Boolean in Java. Booleans
are basically path finders and path changers for programs because they easily shift tracks based
on the evidence user or the program provides to them. For example, the game Rock paper
Scissor. So for this program, if the user entry and program enters the same thing, then they are
equal and no one wins hence the program will redo the process until there is a difference and a
winner can be declared. Post winning program can differ and may be completely independent.
But yes, thats basically how Boolean works. Using some loops, they are really beneficial when
the program has to choose between paths.