package main

import (
"fmt"
"time"
) func GetName() {
//没事玩一下循环
for i := 0; i <= 10; i++ {
fmt.Println(i)
} fmt.Println("你好,世界")
} func modify(array [5]int) {
//这里是强制替换
array[0] = 10
fmt.Println("In modify(), array values:", array) //定义一个数组
mySlice := []int{1, 2, 3, 4, 5}
//这里玩一下range
for i, v := range mySlice {
fmt.Println("mySlice[", i, "] =", v)
} //这里玩一下append
//mySlice = append(array)
//println("测试append:",mySlice)
//反正不知怎么的玩坏了
} func main() {
GetName()
//这里是函数调用
array := [5]int{1, 2, 3, 4, 5}
modify(array)
fmt.Println("In main(), array values:", array)
//Hello world
fmt.Println("Hello World!")
//时间暂停1秒
duration := time.Duration(1) * time.Second
time.Sleep(duration)
}

Golang_test的更多相关文章

  1. go语言实现遍历目录,及查找特定的文件类型

    // filelist.go package main import ( //"flag" "fmt" "os" "path/fi ...

  2. 用go-module作为包管理器搭建go的web服务器

    本篇博客主要介绍了如何从零开始,使用Go Module作为依赖管理,基于Gin来一步一步搭建Go的Web服务器.并使用Endless来使服务器平滑重启,使用Swagger来自动生成Api文档. 源码在 ...

  3. 2.golang应用目录结构和GOPATH概念

    golang 语言有一个GOPATH的概念就是当前工作目录 [root@localhost golang_test]# tree . ├── bin │   └── hello ├── first.g ...

随机推荐

  1. 产生n位元的所有格雷码

    原文链接:http://blog.csdn.net/beiyeqingteng/article/details/7044471 问题:产生n位元的所有格雷码. 格雷码(Gray Code)是一个数列集 ...

  2. 【LeetCode OJ】Linked List Cycle II

    Problem link: http://oj.leetcode.com/problems/linked-list-cycle-ii/ The solution has two step: Detec ...

  3. HDU1166-敌兵布阵(线段树)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166 #include<cstdio> #include<string> #i ...

  4. Unity3D ShaderLab法线贴图

    Unity3D ShaderLab法线贴图 说到法线贴图,应该算是我们最常使用的一种增强视觉效果的贴图.将法线贴图的各个像素点座位模型的法线,这样我们的光照可以模拟出高分辨率的效果, 同时也保持较低的 ...

  5. Java 反射 ParameterizedType 参数化类型

    /***************************************************************************************** * Java 反射 ...

  6. log4j常见问题

    1.日志文件不能生成日期后缀 需求:想要生成的文件是以日期格式为后缀或者结尾的. 设置: log4j.appender.appenderName.DatePattern='.'yyyy-MM-dd 也 ...

  7. ZOJ 3872--解题报告

    题目相关: 3872相关链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5520 Edward拥有一组数列. 其定义了Be ...

  8. 104. Maximum Depth of Binary Tree

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  9. CSS基础知识点(二)——居中

    水平居中 (1) 对于块级元素,最常用的自适应水平居中为:margin:0px auto; (与 margin:auto; 效果相同) (2) 对于行内元素(a, img, input等),最常用的水 ...

  10. Oracle--存储过程学习进阶

    例1:该存储过程是向xuesheng 表中插入一行数 create or replace procedure student_proc_no is begin , , ); commit; end s ...