• Operators

    Logical operators in programming are like a set of tools that help us decide what to do depending on how things look. Logical operators tell the computer to do something based on how two different things compare.

      • Increment Operators

      • The increment operator increments the value of a single variable.

      • Javascript

        Example of increment operator in javascript.
        var age = 20;
        
        // Increment After
        console.log(age++); // 20
        console.log(age); // 21
        
        // Increment Before
        console.log(++age); // 22
        console.log(age); // 22
      • Dart

        Example of increment operator in dart.
        void main() {
          var age = 20;
        
          // Increment After
          print(age++); // 20
          print(age); // 21
        
          // Increment Before
          print(++age); // 22
          print(age); // 22
        }
        
      • D

        Example of increment operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	// Increment After
        	write(age++); // 20
        	write(age); // 21
        
        	// Increment Before
        	write(++age); // 22
        	write(age); // 22
        }
        
      • Php

        Example of increment operator in php.
        <?php
        $age = 20;
        
        // Increment After
        print($age++); // 20
        print($age); // 21
        
        // Increment Before
        print(++$age); // 22
        print($age); // 22
      • Python

        Example of increment operator in python.
        # NA
      • Go

        Example of increment operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	// Increment
        	age++
        	fmt.Println(age) // 21
        
        	// Increment After
        	// NA
        
        	// Increment Before
        	// NA
        }
      • Decrement Operators

      • The decrement operator decrements the value of a single variable.

      • Javascript

        Example of decrement operator in javascript.
        var age = 20;
        
        // Decrement After
        console.log(age--); // 20
        console.log(age); // 19
        
        // Decrement Before
        console.log(--age); // 18
        console.log(age); // 18
      • Dart

        Example of decrement operator in dart.
        void main() {
          var age = 20;
        
          // Decrement After
          print(age--); // 20
          print(age); // 19
        
          // Decrement Before
          print(--age); // 18
          print(age); // 18
        }
        
      • D

        Example of decrement operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	// Decrement After
        	write(age--); // 20
        	write(age); // 19
        
        	// Decrement Before
        	write(--age); // 18
        	write(age); // 18
        }
        
      • Php

        Example of decrement operator in php.
        <?php
        $age = 20;
        
        // Decrement After
        print($age--); // 20
        print($age); // 19
        
        // Decrement Before
        print(--$age); // 18
        print($age); // 18
      • Python

        Example of decrement operator in python.
        # NA
      • Go

        Example of decrement operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	// Decrement
        	age--
        	fmt.Println(age) // 19
        
        	// Decrement After
        	// NA
        
        	// Decrement Before
        	// NA
        }
        
      • Addition Arithmetic Operators

      • The addition operator returns the sum of two variables.

      • Javascript

        Example of addition operator in javascript.
        var age = 20;
        
        console.log(age + 1); // 21
      • Dart

        Example of addition operator in dart.
        void main() {
          var age = 20;
        
          print(age + 1); // 21
        }
      • D

        Example of addition operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age + 1); // 21
        }
        
      • Php

        Example of addition operator in php.
        <?php
        $age = 20;
        
        print($age + 1); // 21
        
      • Python

        Example of addition operator in python.
        age = 20
        
        print(age + 1) # 21
        
      • Go

        Example of addition operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age + 1) // 21
        }
        
      • Subtraction Arithmetic Operators

      • The subtraction operator returns the difference of two variables.

      • Javascript

        Example of subtraction operator in javascript.
        var age = 20;
        
        console.log(age - 2); // 18
      • Dart

        Example of subtraction operator in dart.
        void main() {
          var age = 20;
        
          print(age - 2); // 18
        }
      • D

        Example of subtraction operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age - 2); // 18
        }
        
      • Php

        Example of subtraction operator in php.
        <?php
        $age = 20;
        
        print($age - 2); // 18
        
      • Python

        Example of subtraction operator in python.
        age = 20
        
        print(age - 2) # 18
        
      • Go

        Example of subtraction operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age - 2) // 18
        }
        
      • Multiplication Arithmetic Operators

      • The multiplication operator returns the product of two variables.

      • Javascript

        Example of multiplication operator in javascript.
        var age = 20;
        
        console.log(age * 3); // 60
      • Dart

        Example of multiplication operator in dart.
        void main() {
          var age = 20;
        
          print(age * 3); // 60
        }
      • D

        Example of multiplication operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age * 3); // 60
        }
        
      • Php

        Example of multiplication operator in php.
        <?php
        $age = 20;
        
        print($age * 3); // 60
        
      • Python

        Example of multiplication operator in python.
        age = 20
        
        print(age * 3) # 60
        
      • Go

        Example of multiplication operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age * 3) // 60
        }
        
      • Division Arithmetic Operators

      • The division operator returns the quotient of two variables.

      • Javascript

        Example of division operator in javascript.
        var age = 20;
        
        console.log(age / 2); // 10
      • Dart

        Example of division operator in dart.
        void main() {
          var age = 20;
        
          print(age / 2); // 10
        }
      • D

        Example of division operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age / 2); // 10
        }
        
      • Php

        Example of division operator in php.
        <?php
        $age = 20;
        
        print($age / 2); // 10
        
      • Python

        Example of division operator in python.
        age = 20
        
        print(age / 2) # 10
        
      • Go

        Example of division operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age / 2) // 10
        }
        
      • Modulus Arithmetic Operators

      • The modulus operator returns the remainder of two variables.

      • Javascript

        Example of modulus operator in javascript.
        var age = 20;
        
        console.log(age % 9); // 2
      • Dart

        Example of modulus operator in dart.
        void main() {
          var age = 20;
        
          print(age % 9); // 2
        }
      • D

        Example of modulus operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age % 9); // 2
        }
        
      • Php

        Example of modulus operator in php.
        <?php
        $age = 20;
        
        print($age % 9); // 2
        
      • Python

        Example of modulus operator in python.
        age = 20
        
        print(age % 9) # 2
        
      • Go

        Example of modulus operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age % 9) // 2
        }
        
      • Exponentiation Arithmetic Operators

      • The exponentiation operator returns the power of two variables.

      • Javascript

        Example of exponentiation operator in javascript.
        var age = 2;
        
        console.log(age ** 3); // 8
      • Dart

        Example of exponentiation operator in dart.
        import "dart:math";
        
        void main() {
          var age = 2;
        
          print(pow(age, 3)); // 8
        }
      • D

        Example of exponentiation operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 2;
        
        	write(age ^^ 3); // 8
        }
        
      • Php

        Example of exponentiation operator in php.
        <?php
        $age = 2;
        
        print($age ** 3); // 8
        
      • Python

        Example of exponentiation operator in python.
        age = 2
        
        print(age ** 3) # 8
        
      • Go

        Example of exponentiation operator in go.
        package main
        
        import (
        	"fmt"
        	"math"
        )
        
        func main() {
        	var age float64 = 2
        
        	fmt.Println(math.Pow(age, 3)) // 8
        }
        
      • Addition Assignment Arithmetic Operators

      • The addition assignment operator returns the sum of two counterparts.

      • Javascript

        Example of addition assignment operator in javascript.
        var age = 20;
        
        age += 1;
        
        console.log(age); // 21
      • Dart

        Example of addition assignment operator in dart.
        void main() {
          var age = 20;
        
          age += 1;
        
          print(age); // 21
        }
      • D

        Example of addition assignment operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	age += 1;
        
        	write(age); // 21
        }
        
      • Php

        Example of addition assignment operator in php.
        <?php
        $age = 20;
        
        $age += 1;
        
        print($age); // 21
        
      • Python

        Example of addition assignment operator in python.
        age = 20
        
        age += 1
        
        print(age) # 21
        
      • Go

        Example of addition assignment operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	age += 1
        
        	fmt.Println(age) // 21
        }
      • Subtraction Assignment Arithmetic Operators

      • The subtraction assignment operator returns the difference of two counterparts.

      • Javascript

        Example of subtraction assignment operator in javascript.
        var age = 20;
        
        age -= 2;
        
        console.log(age); // 18
      • Dart

        Example of subtraction assignment operator in dart.
        void main() {
          var age = 20;
        
          age -= 2;
        
          print(age); // 18
        }
      • D

        Example of subtraction assignment operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	age -= 2;
        
        	write(age); // 18
        }
        
      • Php

        Example of subtraction assignment operator in php.
        <?php
        $age = 20;
        
        $age -= 2;
        
        print($age); // 18
        
      • Python

        Example of subtraction assignment operator in python.
        age = 20
        
        age -= 2
        
        print(age) # 18
        
      • Go

        Example of subtraction assignment operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	age -= 2
        
        	fmt.Println(age) // 18
        }
      • Multiplication Assignment Arithmetic Operators

      • The multiplication assignment operator returns the product of two counterparts.

      • Javascript

        Example of multiplication assignment operator in javascript.
        var age = 20;
        
        age *= 3;
        
        console.log(age); // 60
      • Dart

        Example of multiplication assignment operator in dart.
        void main() {
          var age = 20;
        
          age *= 3;
        
          print(age); // 60
        }
      • D

        Example of multiplication assignment operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	age *= 3;
        
        	write(age); // 60
        }
        
      • Php

        Example of multiplication assignment operator in php.
        <?php
        $age = 20;
        
        $age *= 3;
        
        print($age); // 60
        
      • Python

        Example of multiplication assignment operator in python.
        age = 20
        
        age *= 3
        
        print(age) # 60
        
      • Go

        Example of multiplication assignment operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	age *= 3
        
        	fmt.Println(age) // 60
        }
      • Division Assignment Arithmetic Operators

      • The division assignment operator returns the quotient of two counterparts.

      • Javascript

        Example of division assignment operator in javascript.
        var age = 20;
        
        age /= 2;
        
        console.log(age); // 10
      • Dart

        Example of division assignment operator in dart.
        void main() {
          var age = 20;
        
          age ~/= 2;
        
          print(age); // 10
        }
      • D

        Example of division assignment operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	age /= 2;
        
        	write(age); // 10
        }
        
      • Php

        Example of division assignment operator in php.
        <?php
        $age = 20;
        
        $age /= 2;
        
        print($age); // 10
      • Python

        Example of division assignment operator in python.
        age = 20
        
        age /= 2
        
        print(age) # 10.0
        
      • Go

        Example of division assignment operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	age /= 2
        
        	fmt.Println(age) // 10
        }
      • Modulus Assignment Arithmetic Operators

      • The modulus assignment operator returns the remainder of two counterparts.

      • Javascript

        Example of modulus assignment operator in javascript.
        var age = 20;
        
        age %= 9;
        
        console.log(age); // 2
      • Dart

        Example of modulus assignment operator in dart.
        void main() {
          var age = 20;
        
          age %= 9;
        
          print(age); // 2
        }
      • D

        Example of modulus assignment operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	age %= 9;
        
        	write(age); // 2
        }
        
      • Php

        Example of modulus assignment operator in php.
        <?php
        $age = 20;
        
        $age %= 9;
        
        print($age); // 2
        
      • Python

        Example of modulus assignment operator in python.
        age = 20
        
        age %= 9
        
        print(age) # 2
        
      • Go

        Example of modulus assignment operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	age %= 9
        
        	fmt.Println(age) // 2
        }
      • Exponentiation Assignment Arithmetic Operators

      • The exponentiation assignment operator returns the power of two counterparts.

      • Javascript

        Example of exponentiation assignment operator in javascript.
        var age = 2;
        
        age **= 3;
        
        console.log(age); // 8
      • Dart

        Example of exponentiation assignment operator in dart.
        // NA
      • D

        Example of exponentiation assignment operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 2;
        
        	age ^^= 3;
        
        	write(age); // 8
        }
        
      • Php

        Example of exponentiation assignment operator in php.
        <?php
        $age = 2;
        
        $age **= 3;
        
        print($age); // 8
      • Python

        Example of exponentiation assignment operator in python.
        age = 2
        
        age **= 3
        
        print(age) # 8
        
      • Go

        Example of exponentiation assignment operator in go.
        // NA
      • Equal Comparison Operators

      • The equal operator checks if two variables are equal value.

      • Javascript

        Example of equal operator in javascript.
        var age = 20;
        
        console.log(age == 20); // true
      • Dart

        Example of equal operator in dart.
        void main() {
          var age = 20;
        
          print(age == 20); // true
        }
      • D

        Example of equal operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age == 20); // true
        }
        
      • Php

        Example of equal operator in php.
        <?php
        $age = 20;
        
        print($age == 20); // true
        
      • Python

        Example of equal operator in python.
        age = 20
        
        print(age == 20) # True
        
      • Go

        Example of equal operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age == 20) // true
        }
        
      • Equal Type Comparison Operators

      • The equal type operator checks if two variables are equal value and type.

      • Javascript

        Example of equal type operator in javascript.
        var age = '20';
        
        console.log(age === '20'); // true
      • Dart

        Example of equal type operator in dart.
        void main() {
          var age = '20';
        
          print(age == '20'); // true
        }
      • D

        Example of equal type operator in d.
        import std.stdio : write;
        import std.string;
        
        void main()
        {
        	string age = "20";
        
        	write(age == "20"); // true
        }
        
      • Php

        Example of equal type operator in php.
        <?php
        $age = '20';
        
        print($age === '20'); // true
        
      • Python

        Example of equal type operator in python.
        age = '20'
        
        print(age == '20') # True
        
      • Go

        Example of equal type operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age string = "20"
        
        	fmt.Println(age == "20") // true
        }
        
      • Not Equal Comparison Operators

      • The not-equal operator checks if two variables are not equal value.

      • Javascript

        Example of not-equal operator in javascript.
        var age = 20;
        
        console.log(age != 18); // true
      • Dart

        Example of not-equal operator in dart.
        void main() {
          var age = 20;
        
          print(age != 18); // true
        }
      • D

        Example of not-equal operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age != 18); // true
        }
        
      • Php

        Example of not-equal operator in php.
        <?php
        $age = 20;
        
        print($age != 18); // true
        
      • Python

        Example of not-equal operator in python.
        age = 20
        
        print(age != 18) # True
      • Go

        Example of not-equal operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age != 18) // true
        }
        
      • Not Equal Type Comparison Operators

      • The not-equal type operator checks if two variables are not equal value and type.

      • Javascript

        Example of not-equal type operator in javascript.
        var age = 20;
        
        console.log(age !== '20'); // true
      • Dart

        Example of not-equal type operator in dart.
        void main() {
          var age = 20;
        
          print(age != '20'); // true
        }
      • D

        Example of not-equal type operator in d.
        // NA
      • Php

        Example of not-equal type operator in php.
        <?php
        $age = 20;
        
        print($age !== '20'); // true
        
      • Python

        Example of not-equal type operator in python.
        age = 20
        
        print(age != '20') # True
        
      • Go

        Example of not-equal type operator in go.
        // NA
      • Greater Than Comparison Operators

      • The greater-than operator checks if the value of the first variable is greater than the second.

      • Javascript

        Example of greater-than operator in javascript.
        var age = 20;
        
        console.log(age > 18); // true
      • Dart

        Example of greater-than operator in dart.
        void main() {
          var age = 20;
        
          print(age > 18); // true
        }
      • D

        Example of greater-than operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age > 18); // true
        }
        
      • Php

        Example of greater-than operator in php.
        <?php
        $age = 20;
        
        print($age > 18); // true
        
      • Python

        Example of greater-than operator in python.
        age = 20
        
        print(age > 18) # True
      • Go

        Example of greater-than operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age > 18) // true
        }
        
      • Less Than Comparison Operators

      • The less-than operator checks if the value of the first variable is less than the second.

      • Javascript

        Example of less-than operator in javascript.
        var age = 20;
        
        console.log(age < 21); // true
      • Dart

        Example of less-than operator in dart.
        void main() {
          var age = 20;
        
          print(age < 21); // true
        }
      • D

        Example of less-than operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age < 21); // true
        }
        
      • Php

        Example of less-than operator in php.
        <?php
        $age = 20;
        
        print($age < 21); // true
        
      • Python

        Example of less-than operator in python.
        age = 20
        
        print(age < 21) # True
      • Go

        Example of less-than operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age < 21) // true
        }
        
      • Greater Than or Equal Comparison Operators

      • The greater-than or equal-to operator checks if the value of the first variable is greater than or equal to the second.

      • Javascript

        Example of greater-than or equal-to operator in javascript.
        var age = 20;
        
        console.log(age >= 20); // true
      • Dart

        Example of greater-than or equal-to operator in dart.
        void main() {
          var age = 20;
        
          print(age >= 20); // true
        }
      • D

        Example of greater-than or equal-to operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age >= 20); // true
        }
        
      • Php

        Example of greater-than or equal-to operator in php.
        <?php
        $age = 20;
        
        print($age >= 20); // true
        
      • Python

        Example of greater-than or equal-to operator in python.
        age = 20
        
        print(age >= 20) # True
      • Go

        Example of greater-than or equal-to operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age >= 20) // true
        }
        
      • Less Than or Equal Comparison Operators

      • The less-than or equal-to operator checks if the value of the first variable is less than or equal to the second.

      • Javascript

        Example of less-than or equal-to operator in javascript.
        var age = 20;
        
        console.log(age <= 20); // true
      • Dart

        Example of less-than or equal-to operator in dart.
        void main() {
          var age = 20;
        
          print(age <= 20); // true
        }
      • D

        Example of less-than or equal-to operator in d.
        import std.stdio : write;
        
        void main()
        {
        	int age = 20;
        
        	write(age <= 20); // true
        }
        
      • Php

        Example of less-than or equal-to operator in php.
        <?php
        $age = 20;
        
        print($age <= 20); // true
        
      • Python

        Example of less-than or equal-to operator in python.
        age = 20
        
        print(age <= 20) # True
      • Go

        Example of less-than or equal-to operator in go.
        package main
        
        import "fmt"
        
        func main() {
        	var age int = 20
        
        	fmt.Println(age <= 20) // true
        }
        
      • And Logical Operators

      • The and operator checks if the value of the first and second variable are true.

      • Javascript

        Example of and operator in javascript.
        Coming Soon
      • Dart

        Example of and operator in dart.
        Coming Soon
      • D

        Example of and operator in d.
        Coming Soon
      • Php

        Example of and operator in php.
        Coming Soon
      • Python

        Example of and operator in python.
        Coming Soon
      • Go

        Example of and operator in go.
        Coming Soon
      • Or Logical Operators

      • The or operator checks if either the value of the first or second variable is true.

      • Javascript

        Example of or operator in javascript.
        Coming Soon
      • Dart

        Example of or operator in dart.
        Coming Soon
      • D

        Example of or operator in d.
        Coming Soon
      • Php

        Example of or operator in php.
        Coming Soon
      • Python

        Example of or operator in python.
        Coming Soon
      • Go

        Example of or operator in go.
        Coming Soon
      • Xor Logical Operators

      • The xor operator checks if either the value of the first or second variable is true, but not both.

      • Javascript

        Example of xor operator in javascript.
        Coming Soon
      • Dart

        Example of xor operator in dart.
        Coming Soon
      • D

        Example of xor operator in d.
        Coming Soon
      • Php

        Example of xor operator in php.
        Coming Soon
      • Python

        Example of xor operator in python.
        Coming Soon
      • Go

        Example of xor operator in go.
        Coming Soon