Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 1012 Bytes

Session-2.md

File metadata and controls

20 lines (18 loc) · 1012 Bytes

We started with A tour of Go https://go.dev/tour/list

Topics Covered :

  1. Packages
  • go Programs start running in package main .
  1. Imports
  • We can import packages as parenthesized, "factored" import statement or write multiple import statements.
  1. Exported names
  • In Go, a name is exported if it begins with a capital letter, so Go interprets math.Pi but not math.pi
  1. Functions
  • Learn to write functions in Go, with zero, one or multiple parameters. Also, notice type comes after the variable name.
  1. Functions continued
  • Learn how x int, y int can also be written as x, y int
  1. Multiple results
  • A function can return any number of results. Practice this using swap function which returns two or more strings
  1. Named return values
  • A return statement without arguments returns the named return values. This is known as a "naked" return. Use Naked return statements only in short functions.

References