zoukankan      html  css  js  c++  java
  • 后端程序员之路 51、A Tour of Go-1

    # A Tour of Go
        - go get golang.org/x/tour/gotour
        - https://tour.golang.org/
        
    # welcome
        - fmt.Println("The time is", time.Now())

    # basic
        - Packages && Imports
            - package main
            - import (    "fmt"    "math" )
            - fmt.Println("My favorite number is", rand.Intn(10))
            - fmt.Println(math.Pi)
        - Functions
            - func add(x int, y int) int {
            - func add(x, y int) int {
            - Multiple results - func swap(x, y string) (string, string) {
            - Named return values - func split(sum int) (x, y int) {
        - Variables
            - var c, python, java bool
            - var c, python, java = true, false, "no!"
            - Short variable declarations - k := 3
            - bool、string、int8 uint16 uintptr、byte(uint8)、rune(int32)、float32 float64、complex64 complex128
            - Zero values
                - Variables declared without an explicit initial value are given their zero value.
                - 0 for numeric types
                - false for the boolean type
                - "" (the empty string) for strings
        - Type conversions
            - i := 42
            - f := float64(i)
            - u := uint(f)
        - Constants
            - const World = "世界"
            - const ( ... )

  • 相关阅读:
    分享5个viewport相关的jQuery插件
    超棒的响应式jQuery网格布局插件 grida licious
    6款不容错过的超棒倒计时jQuery插件
    分享45套2011年和2012年的高质量免费网站模板
    分享11个使用方便的免费智能手机UI套件
    推荐30款超精致的体育类型的网站设计
    HDOJ1001
    HDOJ1003
    HDOJ1000
    HDOJ1002
  • 原文地址:https://www.cnblogs.com/zapline/p/6823529.html
Copyright © 2011-2022 走看看