- Go Systems Programming
- Mihalis Tsoukalos
- 109字
- 2021-07-02 18:07:58
Naming the return values of a Go function
Unlike C, Go allows you to name the return values of a Go function. Additionally, when such a function has a return statement without any arguments, the function automatically returns the current value of each named return value. Note that such functions return their values in the order they were declared in the definition of the function.
Naming return values is a very handy Go feature that can save you from various types of bugs, so use it.
My personal advice is this: name the return values of your functions unless there is a very good reason not to do so.
推薦閱讀
- 深入理解Bootstrap
- ThinkPHP 5實(shí)戰(zhàn)
- C++ Builder 6.0下OpenGL編程技術(shù)
- Go語言高效編程:原理、可觀測性與優(yōu)化
- 無代碼編程:用云表搭建企業(yè)數(shù)字化管理平臺
- JavaScript+jQuery開發(fā)實(shí)戰(zhàn)
- 實(shí)戰(zhàn)Java程序設(shè)計(jì)
- 老“碼”識途
- 用Flutter極速構(gòu)建原生應(yīng)用
- Hands-On Automation Testing with Java for Beginners
- SQL經(jīng)典實(shí)例(第2版)
- Create React App 2 Quick Start Guide
- C#程序設(shè)計(jì)教程(第3版)
- Python:Deeper Insights into Machine Learning
- 網(wǎng)絡(luò)數(shù)據(jù)采集技術(shù):Java網(wǎng)絡(luò)爬蟲實(shí)戰(zhàn)