Another level is behind you! In the previous lessons, you learned about the if-else conditional statement and the nuances associated with it. We got acquainted with a special data type: boolean. We examined examples of using comparison operators and boolean variables. Finally, we learned more about comparing references and strings.
If you feel that a little more theory and some visual examples definitely won't hurt you, then carry on: here are links to a couple of useful articles.
Equals and comparing strings
Comparing objects is different from comparing primitive data types. You probably already guessed why this is so. In the case of objects, we pass a reference, but in the case of primitives, a value... There are many more interesting nuances that you will learn about from this article. As usual, we will explore the topic using lively examples.
Ternary operator
To beginners, this is very unusual beast. By and large, you can entirely do without it... but the ternary operator shortens the code so easily and beautifully! And this is exactly what a beginner programmer should strive for. If you have not yet had time to thoroughly familiarize yourself with this replacement for the if-else construct, then we recommend that you get to know it better and slowly weave it into your code.
GO TO FULL VERSION