Go language program to Join two given strings

Views: 152   

Following program shows you how to Join two given strings.
In this program we get strings from user and join those strings

package main

import "fmt"

func main() {

  var string1 string
  var string2 string
  var output string
  fmt.Println("Please enter the first string:")
  fmt.Scanf("%s", &string1)
  fmt.Println("Please enter the second string:")
  fmt.Scanf("%s", &string2)
  output = string1 + string2
  fmt.Println("Joined string is: " , output)
}

Output:

Please enter the first string:
 hello
Please enter the second string:
 tom
Joined string is:  hellotom
On By