go array 使用

  • 2022-07-09
  • 浏览 (967)

golang array 使用样例

package main

import (
	"gotest/common"
	"strconv"
	"testing"
)

func TestArray(t *testing.T) {
	var n [10]int

	for i := 0; i < 10; i++ {
		n[i] = i + 100
	}

	for j := 0; j < 10; j++ {
		common.Println(strconv.Itoa(n[j]))
	}

}

测试

执行测试代码 go test -v array_test.go 可以查看执行结果

go test 使用请看:go test 使用

golang 使用样例汇总:go test

你可能感兴趣的文章

go defer 使用

go file 使用

go func 使用

go http 使用

go interface 使用

go main 使用

go map 使用

go math 使用

go method 使用

go range 使用

0  赞