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!")
        }
    }
  • 相关阅读:
    tuple 元组及字典dict
    day 49 css属性补充浮动 属性定位 抽屉作业
    day48 选择器(基本、层级 、属性) css属性
    day47 列表 表单 css初识
    day 46 http和html
    day 45索引
    day 44 练习题讲解 多表查询
    day 40 多表查询 子查询
    day39 表之间的关联关系、 补充 表操作总结 where 、group by、
    day38 数据类型 约束条件
  • 原文地址:https://www.cnblogs.com/harryV/p/3725083.html
Copyright © 2011-2022 走看看