HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Conditional statements are used to perform different actions based on different conditions
A condition can be either true
or false
.
Go supports the usual comparison operators from mathematics:
<
<=
>
>=
==
!=
Additionally, Go supports the usual logical operators:
&&
||
!
You can use these operators or their combinations to create conditions for different decisions.
Go has the following conditional statements:
if
to specify a block of code to be executed, if a specified condition is trueelse
to specify a block of code to be executed, if the same condition is falseelse if
to specify a new condition to test, if the first condition is falseswitch
to specify many alternative blocks of code to be executed