Wednesday, February 10, 2016
Codecademy Learn Java tutorial walkthrough 10: relational operators
Codecademy basics tutorials always cover relational operators for each programming language taught. Relational operators refer to the !=, >, ==, <= in (5!=3) or (5>3) or (5==5) or (5 <= 7). Each is a test to see if the left and right side of the relational operator has the said relation. For example, 5!=3 will evaluate to true because it is testing for whether it is true 5 doesn't equal to 3, and that is indeed the case, so the result is true. What about (5==3)? It tests if 5 equals to 3, and the answer is no so it evaluates to false. The result of a statement with a relational operator almost always only returns only true or false. Do you remember what's the name of the data type that can only be true or false? Yes a Boolean. A Boolean can either be true or false. Why are relational operators useful?
For example in the previous exercise, we used Modulo to see if z % 2 is zero, which means z is even. We can ask the program to do something only of z is even. Below so the pseudo code to do that (pseudo code is descriptive English words that explains what the code which is yet to be written is intended to do).
if ( (z % 2) ==0) print "z is even!"
This code reads first calculate z % 2, and if that is 0, print out a message saying z is even
Did you know that being a developer you are at an unique position to help the society? There are many public service opportunities to contr...
Can hack schools solve Silicon Valley's talent crunch? The truth about coding bootcamps and the students left behind http://t.co/xXNfqN...
The bogus request from P2PU to hunt for HTML tags in real life has yielded a lot of good thoughts. My first impression was that this is stup...
This review is updated continuously throughout the program. Yay I just joined the Udacity Nanodegree for Digital Marketing! I am such an Uda...