我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

我是Golang的新手,并希望说明以下任务

I'm new to Golang and would like to have the following code explained to me, particularly the last part when you assign Pos(0). What is Pos(0) exactly? Thanks!

type Pos uint

var NoPos = Pos(0)

It's a type conversion. It is there to convert 0 to type Pos. It could also be rewritten without a conversion like this:

var NoPos Pos = 0

近期文章

  • 保护不同应用之间的请求
  • Windows中,golang速度很慢[关闭]
  • 可变长度通道创建
  • 在Go中以字符串形式返回格式化日期
  • 无法读取JSON Cookie
  • Golang-内部的Struct如何实现?
  • golang无法反映到map [interface {}] interface {}
  • 为什么Swift函数定义语法多余?
  • 在Go中使用select时有上限吗?
  • 指针的切片到类型的切片到另一个的切片之间的Golang类型转换
  • 托管在AWS上时无法访问Go服务器
  • Golang使并发更容易的主要原因[关闭]
  • VS代码中的linter不适用于跨多个文件的软件包吗?
  • 执行模板到文件
  • Golang卡在WaitGroup中
  • 带有反向引用的golang regexp ReplaceAllStrings不太起作用
  • 如何强制编译器控制值/指针到值函数参数?
  • 如何在Golang中以IST格式解析日期?
  • golang默认将一个json对象解组到map [string] interface {}中,如何将其解组到[] byte?
  • 如何在Go中定义一个包含int和一个字符串切片的切片?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华