WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Go Type casting


Type casting is a way to transform a variable from one data type to another data type.

For example, in case you need to shop a long fee into a simple integer then you may type solid lengthy to int. You can convert values from one type to another using the cast operator . Its syntax is as follows −.
type_name(expression)

Example

Consider the following example where the cast operator causes the division of one integer variable by using some other to be finished as a floating number operation.
package deal main

import "fmt"

func major() 
   var sum int = 20
   var count int = 25
   var imply float32
   
   mean = float32(sum)/float32(rely)
   fmt.Printf("Value of mean : %fn",imply)

Output

$move run foremost.Move
Value of suggest : 0.800000