Skip to content

Go Programming

Google Go Programming – For Loop Adventure

You might have heard about Google Go programming language. It’s a new programming language, just about 5 years old, which is getting loads of traction among the developer community. I am personally trying this from a couple of weeks and found it appealing. First thing first, Go is concise and neat – unlike most of the modern languages which are bloated.

Go is more like C but is quite simple in approach with clean syntax. Fast compilation and built-in support for concurrent programming using the full capability of multi-core CPUs are the USP of Go programming also known as golang.

Go is open source, compiled & statically typed language. I’ve a feeling that Go is going to pick up in the next couple of years. Any developer who is curious to learn a new language must consider Go. For students I’ll recommend Go over C as for the first time learners you don’t need to unlearn anything. For experienced programmers you need to unlearn many traditional approaches of programming and learn the Go way – a little challenging as it is a bit tough to get rid of established habits.

Moreover with Go 1.4 release, it will support Android app development.

This exercise is targeted to experienced programmers, those who are familiar with looping constructs in any other programming language. This exercise might help you to understand the basic syntax of the language apart from giving you a feel of the clean syntax of the language.  Let us try to produce the following using golang.


The code looks like the one mentioned below. See how Go has got rid of the semi colons and brackets. The following uses two for loop (nested loops) to produce the desired asterisk format. Go officially offers an online playground which can be used for testing snippets of code. I’ve written the following code there. You can check the code and output here.


How was that. Please feel free to share your comments.

Be Sociable, Share!
    The following two tabs change content below.

    Basant Singh

    Basant is a talented software developer who is very engaged in web & cloud platforms on a daily basis. He is a contributor to reporting on various news and troubleshooting on various platforms. Basant is very strong in SQL and a great asset to the CodingThis community.

    Latest posts by Basant Singh (see all)