Sunday, November 29, 2020
Home Fun With Programming Go Programming Go Programming Language – Introduction

Go Programming Language – Introduction

In this, We are going to discussing about Go Programming Language. So let’s begin….

Introduction :

It is the Go programming language. It is also called the Golang programming language and this is supported by big companies like Google, Intel, IBM, etc. In 2007, the programming language was developed by Robert Griesemer, Rob Pike, Ken Thompson on Google.

What is GOLANG?

Go Programming language is an Open source so that makes it easy to build, reliable, and efficient software. Go Programming language is a static -typed Compiled language and its compilation time is very fast. Its syntax is derived from C and C++.

Go is designed and supported by Google. Google has one of the largest cloud infrastructures in the world and it is scaled massively.

Why GoLang?

  • Scalable-leads to business growth
  • Quick Compilation- Fast go to market.
  • Concurrency -Simultaneous task execution.
  • Error checks -Bug-free applications.
  • Platform portability -Low costs.

Features of Go programming Language

  • Multithreading
  • Minimum Dependencies
  • Good Package Management
  • Powerful standard Library
  • Static Typing
  • Testing support
  • Platform Independent

Basic Structure of GoLang

  • Package Declaration
  • Import Packages
  • Variables
  • Statements and Expressions
  • Functions
  • Comments

Example:

Create a Go file demo.go

package main
import "fmt"
func main()
{
    fmt.Println("Hello World");
}

Now run the demo.go file to see the result

c:\Go_WorkSpace>go run demo.go

Every Go program should start with a package name,import the package fmt.This package implements I/O functions.

func main is the function it is placed in the main package.Under the main(),we can write the code inside the {…}

fmt.println will print the text on the screen.

Data Types and Variables

Data types

Numeric types: This includes numeric values like integer, floating-point, and complex values and There are different sizes of integers values I (int8,int16,int32,int64, etc.)
String types: These represent bytes we can do various types of operations like concatenation, extracting, substring, etc.
Boolean types: There are two types of values either true or false.

Variables

Variables are to stores a values in the memory location. variable can be declare using the syntax

var <variable name><type>
we can also give initial value to the variable : var <variable name><type>=<value>

we can also use multiple values foe example:

var <variable name1,><variable name2,> = <Value1>,<value2>

Example:

package main
import "fmt"
func main(){
var x int =5
     fmt.println("x:",x)
var i , j =22,"hello"
      fmt.println("i and j:",i,j)
}

Output:

x : 5
i and j : 100 hello

Constants:

Constants values are those whose value can not be change and it is declare by using the keyword “const”

example:

package main
import  "fmt"
func main(){
const Pie =3.14
r=3
var area int
area = 4*Pie*r*r
fmt.println("area: %d",area)

Output : area: 113.04

Read More:-

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Best Tricks For Play & Win Ludo

Ludo King Game has now become the world’s popular game. Everyone, children, old and young, like to play this game.

How To Delete Facebook Account Permanently?

Today we will know about one problem, which people keep talking about, today we will know how to delete Facebook account. With...

Unlock password-protected Zip File without a password

Hi! Friends! How are you today? Today we are going to tell you something interesting in the Smart Tricks & tips Section....

Bootstrap Media Queries

Since Bootstrap is developed to be mobile-first, we use a handful of media queries to create sensible breakpoints for our layouts and interfaces. These...

Recent Comments