GO Program to print different types of values

How to display different types of values

Here we are explaining how to display different types of values in the Go program. We can use the built-in function fmt.println() to print the variables. 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 display different types of values in GO Program

We are using fmt.println() function for printing the string to the output screen. Here we are showing how to print different types of values in the Go language. Different types of values like strings, integers, floats, booleans using fmt.println(). Given below are the steps which are used in the Go program. 

ALGORITHM

STEP 1: Import the package fmt

STEP 2: Start function main()

STEP 3: Display different values like strings, integers, floats, booleans using fmt.println()

GO Source Code

                                          package main
import "fmt"
func main() {

    fmt.Println("hii" + "sir")
    fmt.Println("1+2 =", 1+2)
    fmt.Println("7.0/3.0 =", 7.0/3.0)
    fmt.Println(true && false)
    fmt.Println(true || false)
    fmt.Println(!true)
}
                                      

OUTPUT

hiisir
1+2 = 3
7.0/3.0 = 2.3333333333333335
false
true
false