Grokking Go
Vote

0% completed

​

Go - if else Statement

The if else statement in Go is used when you need to execute one block of code if a condition is true and a different block if the condition is false. It allows for handling both possibilities in a decision-making process.

Syntax of the if else Statement

if condition { // Code executes if condition is true } else { // Code executes if condition is false }

Explanation of Syntax

  • condition → A Boolean expression (Evaluates to true or false).
  • if block → It runs when the if condition is true.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content