{"id":677,"date":"2025-07-22T09:31:33","date_gmt":"2025-07-22T09:31:33","guid":{"rendered":"https:\/\/tipcontrol.com\/?page_id=677"},"modified":"2025-07-22T09:31:33","modified_gmt":"2025-07-22T09:31:33","slug":"operators-overview","status":"publish","type":"page","link":"https:\/\/tipcontrol.com\/?page_id=677","title":{"rendered":"Operators Overview"},"content":{"rendered":"\n<ol class=\"wp-block-list\">\n<li><strong>Addition (<code>+<\/code>)<\/strong>: Adds two operands.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>sum = 3 + 2; \/\/ sum is 5<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Subtraction (<code>-<\/code>)<\/strong>: Subtracts the right operand from the left operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>difference = 5 - 3; \/\/ difference is 2<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Multiplication (<code>*<\/code>)<\/strong>: Multiplies two operands.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>product = 4 * 2; \/\/ product is 8<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Division (<code>\/<\/code>)<\/strong>: Divides the left operand by the right operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>quotient = 10 \/ 2; \/\/ quotient is 5<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Modulus (<code>%<\/code>)<\/strong>: Returns the remainder of division of the left operand by the right operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>remainder = 10 % 3; \/\/ remainder is 1<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Logical AND (<code>&amp;<\/code>)<\/strong>: Performs a logical AND operation on each bit; true if both operands are true.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>result = true &amp; 1; \/\/ result is true (true AND true)<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Logical OR (<code>|<\/code>)<\/strong>: Performs a logical OR operation on each bit; true if at least one operand is true.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>result = false | 0; \/\/ result is false (true OR false)<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Logical XOR (<code>^<\/code>)<\/strong>: Performs a logical XOR operation on each bit; true if operands are different.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>result = 1 ^ 0; \/\/ result is true (true XOR false)<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Assignment (<code>=<\/code>)<\/strong>: Assigns the value of the right operand to the left operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>a = 5.3; \/\/ a is assigned the value 5.3<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Not Equal (<code>!=<\/code>)<\/strong>: Returns true if the operands are not equal.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>isNotEqual = (5 != 3); \/\/ isNotEqual is true<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Less Than (<code>&lt;<\/code>)<\/strong>: Returns true if the left operand is less than the right operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>isLess = (3 &lt; 5); \/\/ isLess is true<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Greater Than (<code>><\/code>)<\/strong>: Returns true if the left operand is greater than the right operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>isGreater = (7 > 4); \/\/ isGreater is true<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Equal (<code>==<\/code>)<\/strong>: Returns true if the operands are equal.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>isEqual = (5 == 5); \/\/ isEqual is true<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Less Than or Equal To (<code>&lt;=<\/code>)<\/strong>: Returns true if the left operand is less than or equal to the right operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>isLessOrEqual = (3 &lt;= 5); \/\/ isLessOrEqual is true<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Greater Than or Equal To (<code>>=<\/code>)<\/strong>: Returns true if the left operand is greater than or equal to the right operand.\n<ul class=\"wp-block-list\">\n<li><strong>Example<\/strong>:\u00a0<code>isGreaterOrEqual = (7 >= 4); \/\/ isGreaterOrEqual is true<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Compound Assignments<\/h3>\n\n\n\n<p>Arithmetic operators (<code>+<\/code>, <code>-<\/code>, <code>*<\/code>, <code>\/<\/code>, <code>%<\/code>) can be combined with the assignment operator (<code>=<\/code>) to update a variable&#8217;s value directly after performing the operation. This is known as compound assignment:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Addition Assignment (<code>+=<\/code>)<\/strong>:\u00a0<code>a += b<\/code>\u00a0is equivalent to\u00a0<code>a = a + b<\/code>.<\/li>\n\n\n\n<li><strong>Subtraction Assignment (<code>-=<\/code>)<\/strong>:\u00a0<code>a -= b<\/code>\u00a0is equivalent to\u00a0<code>a = a - b<\/code>.<\/li>\n\n\n\n<li><strong>Multiplication Assignment (<code>*=<\/code>)<\/strong>:\u00a0<code>a *= b<\/code>\u00a0is equivalent to\u00a0<code>a = a * b<\/code>.<\/li>\n\n\n\n<li><strong>Division Assignment (<code>\/=<\/code>)<\/strong>:\u00a0<code>a \/= b<\/code>\u00a0is equivalent to\u00a0<code>a = a \/ b<\/code>.<\/li>\n\n\n\n<li><strong>Modulus Assignment (<code>%=<\/code>)<\/strong>:\u00a0<code>a %= b<\/code>\u00a0is equivalent to\u00a0<code>a = a % b<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>These operators provide a shorthand way to update variables, making code more concise and potentially improving readability.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Compound Assignments Arithmetic operators (+, -, *, \/, %) can be combined with the assignment operator (=) to update a variable&#8217;s value directly after performing the operation. This is known as compound assignment: These operators provide a shorthand way to update variables, making code more concise and potentially improving readability.<\/p>\n","protected":false},"author":4,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-677","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/tipcontrol.com\/index.php?rest_route=\/wp\/v2\/pages\/677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tipcontrol.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tipcontrol.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tipcontrol.com\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/tipcontrol.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=677"}],"version-history":[{"count":1,"href":"https:\/\/tipcontrol.com\/index.php?rest_route=\/wp\/v2\/pages\/677\/revisions"}],"predecessor-version":[{"id":679,"href":"https:\/\/tipcontrol.com\/index.php?rest_route=\/wp\/v2\/pages\/677\/revisions\/679"}],"wp:attachment":[{"href":"https:\/\/tipcontrol.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}