...

Web Technologies - Go Language

Back to Course

Lesson Description


Lession - #368 Go-Type Casting


Go - Type Conversion

Type transformation is a method for changing over a variable starting with one information type then onto the next information type. For instance, if you need to store a long worth into a basic whole number then you can type cast long to int. You can switch values starting with one sort over completely then onto the next utilizing the cast administrator. Its grammar is as per the following −

type_name(expression>


Example

package main

import "fmt"

func main(>
{ var sum int = 17 var count int = 5 var mean float32 mean = float32(sum>
/float32(count>
fmt.Printf("Value of mean : %f\n",mean>
}