Page 14 - مجلة طموح IT
P. 14

&& OPERATOR (and)                                        operator ‫عمليات المقارنة والعلاقات‬
 a b a && b                                                     ‫العملية الوصف‬
true true true
true false false            Logical Operator                       ‫المساوات‬       ==
false true false              ! not operator                     ‫عدم المساوات‬     !=
false false false                                                                 <
                            && and operator                        ‫اقل من‬         >
                               || or operator                      ‫اكثر من‬        <=
                                                                ‫اقل من او يساوي‬   >=
                                                                ‫اكثر من او يساوي‬

          || OPERATOR (or)
 a b a || b
true true true

true false true

false true  true

false false false

( (5 == 5) && (3 > 6) ) // evaluates to false ( true && false                     ‫على سبيل المثال‬

(5 == 5) || (3 > 6) ) // evaluates to true ( true || false ) )

                            Conditional Ternary Operator ( ? )

7==5 ? 4 : 3 // evaluates to 3, since 7 is not equal to 5.
7==5+2 ? 4 : 3 // evaluates to 4, since 7 is equal to 5+2.
5>3 ? a : b // evaluates to the value of a, since 5 is greater
than 3.
a>b ? a : b // evaluates to whichever is greater, a or b.

                            14
   9   10   11   12   13   14   15   16   17   18   19