GO Program to concatenate two string

How to concatenate two strings

Here we are explaining how to concatenate two strings in the Go program. We can use the built-in function fmt.println() to print anything and fmt.scanln() for reading the values. This function is defined under the fmt package and it helps to write standard output. In order to use these functions, we need to import the “fmt” package.


How to concatenate two strings in the GO Program

We are using fmt.println() function for printing the string to the output screen. Here we are showing how to concatenate two strings in the Go language. Here variables str1,str2 are holding the string to be concatenated. And variable str for holding the result string. Finally, the strings are concatenated using  str3:= str1 + str2 and print the result. Given below are the steps which are used in the Go program. 


STEP 1: Import the package fmt

STEP 2: Start function main()

STEP 3: Declare the string variable str1,str2 for concatenate

STEP 4: Consider variable str3 for holding the result string

STEP 5: The concatenation is done as str3 := str1 + str2

STEP 6: Finally print the variable str using fmt.Println()


GO Source Code

                                          package main

import (

func main() {

    str1 := "Go"
    str2 := "Programming"
    str3 := str1 + str2



Go Programming