Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 5. Procedural Programming

5. Procedural Programming

§5.1. Statement Basics 186

§5.1.1. Type Conversions 190

§5.1.2. Type Assertions 191

§5.2. Branching 192

§5.2.1. If Statements 192

§5.2.2. Switch Statements 195

§5.3. Looping with For Statements 203

§5.4. Communication and Concurrency Statements 205

§5.4.1. Select Statements 209

§5.5. Defer, Panic, and Recover 212

§5.5.1. Panic and Recover 213

§5.6. Custom Functions 219

§5.6.1. Function Arguments 220

§5.6.2. The init() and main() Functions 224

§5.6.3. Closures 225

§5.6.4. Recursive Functions 227

§5.6.5. Choosing Functions at Runtime 230

§5.6.6. Generic Functions 232

§5.6.7. Higher Order Functions 238

§5.7. Example: Indent Sort 244

The purpose of this chapter is to complete the coverage of Go procedural programming that the earlier chapters began. Go can be used to write purely procedural programs, to write object-oriented programs, or to write programs that combine both paradigms. It is important to learn procedural Go since object-oriented Go builds on the procedural foundations, as does concurrent Go programming.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint