This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 15k traffic Daily!!!

Operators in GO – DEV Community


  • Operators are used to carry out operations on variables and values.
  • Operators permit operands to be mixed into expressions
  • Operators are both binary operators or unary operators. A binary operator operation takes two operands and a unary operator operation takes just one operand.



Arithmetic Operators

  • Go helps the next arithmetic operators.
    Image description

  • To reveal the usage of arithmetic operators; create new folder as 03-01 ArithmeticOperators in src folder of the workspace and create arithmetic_op.go file and kind the next code.

  • Following is the output of above instance.

Image description

  • Commit and push adjustments to GitHub.

$ git add .
$ git commit -m "03-01 ArithmeticOperators"
$ git push origin grasp



Project Operators

  • Project operators are used to assign values to variables.
  • Following is the listing of task operators.
    Image description
  • Create 03-02 AssignmentOperators folder in src folder and add a file assignment_op.go and kind the next instance.

  • Following is the output of above instance.
    Image description

  • Commit adjustments to GitHub

$ git add .
$ git commit -m "03-02 AssignmentOperators"
$ git push origin grasp



Comparability/Relational Operators

  • Comparability operators are used to check two values.
  • Following is the listing of comparability operators.
    Image description

  • The next instance demonstrates the utilization of comparability operators. Create folder 03-03 ComparisonOperators in src folder and file with the title comparison_op.go

  • Following is the output.
    Image description

  • Commit adjustments to GitHub.

$ git add .
$ git commit -m "03-03 ComparisonOperators"
$ git push origin grasp



Logical Operators

  • Logical operators are used for operations on Boolean values throughout the logical expressions.
  • Following is the listing of logical operators supported by Go.
    Image description

  • Let’s create a folder 03-04 LogicalOperators in src folder of your workspace after which create file logical_op.go

  • On execution the next output might be proven.
    Image description

  • Commit adjustments to GitHub.

$ git add .
$ git commit -m "03-04 LogicalOperators"
$ git push origin grasp



Bitwise Operators

$ git add .
$ git commit -m "03-05 BitwiseOperators"
$ git push origin grasp



Operators Priority

  • Operator priority determines the grouping of phrases in an expression.
  • This impacts how an expression is evaluated.
  • The next desk lists Go’s operator priority stage, beginning with the very best.
    Image description

The Article was Inspired from tech community site.
Contact us if this is inspired from your article and we will give you credit for it for serving the community.

This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 10k Tech related traffic daily !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to Contribute to us or want to have 15k+ Audience read your Article ? Or Just want to make a strong Backlink?