10. Basic Types

Source: Internet
Author: User

The basic types of the Go language are:

Bool // Boolean

String // string type

Int int8 int16 int32 int64 // signed integer

Uint uint8 uint16 uint32 uint64 // unsigned integer

Byte // uint8 alias, character type

Rune // uint32 alias, indicating a unicode pointer

Float32 float64 float

Complex64 complex128 complex types

 1 Package main
2
3 Import (
4 " Math/cmplx "
5 " FMT "
6 )
7
8 VaR (
9 Tobe bool = false
10 Maxint uint64 = 1 <64-1
11 Z complex128 = cmplx. SQRT (-5 + 12i)
12 )
13
14 Func main (){
15 Const F = " % T (% v) \ n "
16 FMT. printf (F, Tobe, Tobe)
17 FMT. printf (F, maxint, maxint)
18 FMT. printf (F, Z, Z)
19 }
 
Bool (false) uint64 (18446744073709551615) complex128 (2 + 3I ))

Note: % t indicates the type of the variable to be retrieved.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.