For a better understanding of this example, we always recommend you to learn the basic topics of Golang programming listed below:
A coded object that involves memory allocation directly where it is created is called a data type or type of values in a computer programming language. Golang data types are basic data types of numbers, characters, boolean, etc., and composite data types that are user-defined data types built using basic data types like int, float, etc.
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.
STEP 1: Import the package fmt
STEP 2: Start function main()
STEP 3: Display different values like strings, integers, floats, booleans using fmt.println()
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)
}
hiisir 1+2 = 3 7.0/3.0 = 2.3333333333333335 false true false