AWS Tip

Best AWS, DevOps, Serverless, and more from top Medium writers .

Follow publication

Member-only story

Go For Python Developers

Part 1: Variables and Constants

Umangshrestha
AWS Tip
Published in
4 min readNov 30, 2021

--

This is an hands on introduction to Go, for people who are already familiar with python programming languages. In this article we will be writing our first Go program and learn about variables and constant.

Hello World

We will start with the traditional hello world program.

Go like most of the compiled programming language has little boilerplate code associated with it. main function in the package main is the entry point for the application.

fmt the package provides stdin and stdout support. Println will as the name suggests print the variable and add a new line. It is also worth pointing out that the packages naming conventions are all small letters followed by the function which starts with a capital letter. It is because capital letter means the variable and functions are global scopes.

The third thing we can notice is that Go uses curly braces{} to create a block, unlike python which uses indentation.

Running the script

To run the python we normally do:

$ python main.py

To run the go code we can use:

$ go run main.go 

--

--

Published in AWS Tip

Best AWS, DevOps, Serverless, and more from top Medium writers .

Written by Umangshrestha

I like computer and programming. I am currently trying to learn how to write articles for sharing what I know.

No responses yet

Write a response