首页 > 其他分享 >Go中三个点(...)用法

Go中三个点(...)用法

时间:2022-09-01 22:36:44浏览次数:44  
标签:... index value 用法 111 arg Go 4555

//接受可变长参数
func arg(args ...string){
    for i,v:=range args{
        fmt.Printf("index %d, value %v \n",i,v)
    }
}

func main(){
    temp:=[]string{"111","4555"}
    arg(temp...) //解包切片
    arg("222","3333","6666")//多个不确定数量的参数
}
//输出

  index 0, value 111
  index 1, value 4555
  index 0, value 222
  index 1, value 3333
  index 2, value 6666

 

标签:...,index,value,用法,111,arg,Go,4555
From: https://www.cnblogs.com/zxqblogrecord/p/16648078.html

相关文章

  • django框架-3
    目录小练习django请求生命周期流程图路由匹配反向解析无名有名反向解析路由分发名称空间9.1小练习小练习作业题:用django编写用户数据的增删改查自己写这道题整理的一......
  • 报错:①Tog goal specified requires a project to execute but there is no POM in th
    在运行Maven的命令时,在DOS窗口里面必须把目录切换到项目的根部,要不然命令是找不到目的地。下图是错误示范,项目在Demo02这个目录里,就必须将目录切换到Demo02下,否则DOS窗口......
  • django框架-04
    目录用户信息编辑django请求生命周期流程图django路由匹配反向解析反向解析有名无名反向解析路由分发名称空间用户信息编辑用户管理系统(单表) 1.配置文件 2.模型类......
  • Django之路由层
    django请求周期生命流程图django的生命周期是从用户发送HTTP请求数据到网站响应的过程。整个过程的流程包括:浏览器发送HTTP请求——>wsgiref服务——>中间件—......
  • django3/路由层小知识
    Django请求声明周期流程图路由匹配反向解析无名有名反向解析路由分发名称空间django请求生命周期流程图浏览器默认基于HTTP协议访问web服务网关接口(WebServerGa......
  • Django请求生命周期与反向解析
    Django请求生命周期与反向解析Django请求生命周期流程图Django路由匹配(多版本)1.路由 path('网址后缀',函数名(类名)) 一旦网址后缀匹配上了就会自动执行后面的函数......
  • Dragonfly memory store All In One
    DragonflymemorystoreAllInOneAModernRedisReplacementrobablythefastestmemorystoreintheuniverse.FullycompatiblewithRedis™*andMemcached.Sc......
  • go etcd clientV3 带tls demo
    go操作etcdV3终端操作etcd链接:https://www.cnblogs.com/zisefeizhu/p/15427799.html安装etcdclientV3$getgo.etcd.io/etcd/clientv3#github.com/c......
  • Go ORM框架ent快速上手
    https://entgo.io/docs/getting-startedhttps://github.com/ent/entent是一款facebook开源的go语言ORM框架,类似于gorm等用于实现数据库对象映射和操作的框架。ent的不同......
  • [Google] LeetCode 150 Evaluate Reverse Polish Notation
    EvaluatethevalueofanarithmeticexpressioninReversePolishNotation.Validoperatorsare+,-,*,and/.Eachoperandmaybeanintegeroranotherexpres......