zoukankan      html  css  js  c++  java
  • my first go

    /**
     * Created with IntelliJ IDEA.
     * User: li_zhe
     * Date: 14/05/06
     * Time: 12:34
     * To change this template use File | Settings | File Templates.
     */
    package main
    
    //实现格式化的I/O
    import "fmt"
    
    func main() {
    
        //var a int
        //var b bool
    
        //a = 15
        //b = false
    
        a := 15
        b :=false
    
        fmt.Println(a)
        fmt.Println(b)
    
        //var (
            //a int
            //b bool
        //)
    
        c,d := 12,15
        fmt.Println(c)
        fmt.Println(d)
    
        //任何赋给'_'的值都会被丢弃
        _,e := 20,21
        fmt.Println(e)
    
        fmt.Printf("Hello world!")
    
        const (
            l = iota
            j = iota
        )
        fmt.Println(l)
        fmt.Println(j)
    
        var s string = "HELLO"
        by := []byte(s)
        by[0] = 'c'
    
        s2 := string(by)
        fmt.Printf("%s
    " , s2)
    
    
    
    }
    /**
     * Created with IntelliJ IDEA.
     * User: li_zhe
     * Date: 14/05/13
     * Time: 11:25
     * To change this template use File | Settings | File Templates.
     */
    package main
    
    import "fmt"
    
    func main() {
    
        s := "HELLO " + "WORLD"
        fmt.Printf(s+"
    ")
    
        var c complex64 = 5+5i
        fmt.Printf("Value is: %v",c)
        fmt.Printf("
    ")
    
        list := []string{"a","b","c","d","e"}
    
        for k,v := range list {
    
            fmt.Println(k)
            fmt.Printf(v+"
    ");
        }
    
        for pos,char := range "Process" {
            fmt.Printf("Charactor '%c' starts at byte position %d
    ",char,pos)
        }
    
        for i := 0 ;i < 10 ;i++ {
    
            if i > 5 {
                continue
            }
            fmt.Println(i)
        }
    
        fmt.Println("===============================")
    
        K: for i := 0;i < 10; i++ {
               for j := 0;j < 10; j++ {
    
                   if j > 5 {
                       break K
                   }
                   fmt.Println(j)
               }
        }
    
        i := 0
        switch i {
    
            case 0:fallthrough
            case 1:
                 fmt.Printf("is 1!")
            default:
                fmt.Printf("is default!")
        }
    
        switch i {
    
        case 0,1,2,3:
            fmt.Printf("true!")
        case 5:
            fmt.Printf("is 1!")
        default:
            fmt.Printf("is default!")
        }
    }
  • 相关阅读:
    python_58_装饰器1
    python_57_高阶函数
    python_56_递归
    python_55_局部和全局变量
    python_54_函数调用函数
    python_53_函数补充
    python_52_函数返回值2
    mysql 使用 GROUP BY 时报错 ERROR 1055 (42000)
    sql之left join、right join、inner join的区别
    C++ 函数的重载和参数默认值
  • 原文地址:https://www.cnblogs.com/harryV/p/3725083.html
Copyright © 2011-2022 走看看