02-func

command
v0.0.0-...-a7405e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 1 Imported by: 0

README

function

大小写来表示是否是public

  • 大写开头的方法 public 可以在别的包文件中使用
  • 小写开头的方法
  • _ 开头的方法 ??

怎么区分static, 这里还不涉及到类,所以所有方法都是static的,不存在C++/java中的static方法的说法.

使用参数时,值的传递方法

golang中的传参一定是值传递了 在处理map,channel和slice等这些内置结构的数据时,其实处理的是一个指针类型的数据,也是因此,在函数内部可以修改(部分修改)数据的内容.

所以有时候,在结构体中需要写地址,方便后续处理修改

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL