6.float type and type char

float32  float64

main Package 

Import "FMT" 

FUNC main () { 
	var XXX float32 
	var float64 XXXX 
	XXX = -3542341.044434 
	XXXX = -3542341.044434 
	fmt.Print (XXX, XXXX) 
} 

-3.542341e -3.542341044434e + 06 + 06 bit integer index

  

 

golang no specific type char byte can be used to store 0-255

main Package 

Import "FMT" 

FUNC main () { 
	var byte XXX 
	XXX = 'X' 
	fmt.Println (XXX) 
} 

is directly output byte will be converted to the corresponding code value assci 

summarized:
  1. If the stored character code may be parsed range assci may be directly stored into the byte int consider if more than 255 or larger uint
  2. fmt.Printf output format

  

Character type Details

  1 comprises a character constants in single quotation marks, greater than 255 using other types of defined int

  2. Go run using the escape character '\' character to escape the constant behind it

  3. Go using utf-8 encoded

     English one byte characters three bytes

  4. In Go, the nature of the character is an integer may have the following

main Package 

Import "FMT" 

FUNC main () { 
	// var XXX byte = 'X' 
	// fmt.Println (XXX) 
	// fmt.Printf ( "% C", XXX) 
	var str2 int 
	str2 = 25555 
	fmt.Printf ( "C%", str2) 
} 
C: /Go/bin/go.exe RUN test.go [D: / goproject / First / a float-Test] 
Shi success: process exit code of 0.

  The characters calculation is equivalent to calculating integer between

 

Guess you like

Origin www.cnblogs.com/leleyao/p/11547257.html