What is the meaning of <=,>= | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is the meaning of <=,>=

Pls answer

15th Sep 2019, 2:02 PM
Adarsh Singh
Adarsh Singh - avatar
3 Respostas
+ 4
Usualy we use these operators as part of a condition. Statments like: if(), while(), for() if(age >= 18) print("You are welcome"); while(i <= 10) print(i++); >= will be evaluate to TRUE if "equals to" or "larger then"... <= will be evaluate to TRUEif "equals to" or "smaller then"...
15th Sep 2019, 2:26 PM
šŸ‚B. Eitan šŸŒµ
šŸ‚B. Eitan šŸŒµ - avatar
+ 1
smaller than or equal to, larger than or equal to
15th Sep 2019, 2:03 PM
Airree
Airree - avatar
0
Are you already familiar with < and >? <= and >= are very similar, but they have a difference. There is a good reason why <= and >= exist. When you want to check whether value A is greater than value B, there are 3 cases: A is greater than B A is less than B A is equal to B Give extra attention to the last given case: A is equal to B If you want to compare A and B with "greater than" or "less than" operators, how would you want to handle the case where they are equal, would the comparison return true or false? That is the difference between <, > and <=, >=. In cases where compared value are equal: < and > result to false <= and >= result to true When A and B are equal: A < B āž” False A > B āž” False A <= B āž” True A >= B āž” True
15th Sep 2019, 3:46 PM
Seb TheS
Seb TheS - avatar