If statements and comparisons

in #coding5 years ago

If statement is used for comparing. Please look at the screenshot to see how it's done.

The if statement compares the numbers and if it is true, it returns the output and false if it is not true.

The true or false value is got by giving the comparison.

Capture.JPG

The usual comparison operators are:
(= =) - equal to

(>) - greater than

(<) lesser than

(>=) greater than or equal to

(<=) lesser than or equal to

[!=] not equal

I put them in brackets because markdown is messing with it.

We can also compare strings. Comparison is not limited to numbers alone.

These comparison operators are extremely useful.

Image source - screenshot of colab

Sort:  

Congratulations @filler! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You received more than 100 as payout for your posts. Your next target is to reach a total payout of 250

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

SteemFest Meet The Stemians Contest - The mysterious rule revealed
Vote for @Steemitboard as a witness to get one more award and increased upvotes!