____  ___    _  _     _   _ _____     _______
 / ___|/ _ \  | || |   | | | |_ _\ \   / / ____|
| |  _| | | | | || |_  | |_| || | \ \ / /|  _|
| |_| | |_| | |__   _| |  _  || |  \ V / | |___
 \____|\___/     |_|   |_| |_|___|  \_/  |_____|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

'If' Statement In 'Go'(Learn 'Go' - Part 12)

BY: @technological | CREATED: May 25, 2018, 4 p.m. | VOTES: 3 | PAYOUT: $0.00 | [ VOTE ]

The 'If' statement is used to check a certain condition within a function.

We can create a simple program to see 'if' in action.

 
 

package main

import "fmt"

func main(){

x := 1

for i <= 50{

if i % 5 == 0

{fmt.Println(i)}

i++

}

}

 
 

This program will print the multiples of 5 upto 50.

 

Breakdown Of The Program

 

 
 

 
 
 

Previous Posts In The Series

 
 

Introduction To 'Go' Programming Language(Learn 'Go' - Part 1)

 

25 Basic Keywords Of The Go Programming Language (Learn 'Go' - Part 2)

 

How To Set The Go Programming Environment On Your System?(Learn 'Go' - Part 3)

 

Create Your First Program In Go Language (Learn 'Go' - Part 4)

 

Strings In 'Go'(Learn 'Go' - Part 5)

 

Booleans In 'Go'(Learn 'Go' - Part 6)

 

Numbers In 'Go'(Learn 'Go' - Part 7)

 

Variables In 'Go'(Learn 'Go' - Part 8)

 

Constants In 'Go'(Learn 'Go' - Part9)

 

Multiple Variables In 'Go'(Learn 'Go' - Part10)

 

For Loop In 'Go'(Learn 'Go' - Part11)

 
 

Upcoming Posts

 

Switch In 'Go'(Learn 'Go' - Part 13)

TAGS: [ #programming ] [ #learngo ]

Replies

@steemitboard | May 25, 2018, 8:38 p.m. | Votes: 0 | [ VOTE ]

Congratulations @technological! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[IMAGE: https://steemitimages.com/70x80/http://steemitboard.com/notifications/posts.png] Award for the number of posts published

Click on any badge to view your Board of Honor.

To support your work, I also upvoted your post!
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last announcement from @steemitboard!

> Do you like SteemitBoard's project? Vote for its witness and get one more award!

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>