Featured image of post 25 Keywords in Go

25 Keywords in Go

Go supports only 25 keywords. It’s very simple, which has the advantage of a low learning curve. I’ve never posting it while using Go. Let me summarize the meaning of each keyword today.

break     default      func    interface  select
case      defer        go      map        struct
chan      else         goto    package    switch
const     fallthrough  if      range      type
continue  for          import  return     var


Group Keyword Description
Declaration const scalar value
var variables
func function
type new struct type
import import package
package grouped as unit in a package
Composite types chan go channel
interface Used to specify a method set
map define map type
struct collection of fields
Control flow break terminate a loop
case form of a switch construct
continue go back to the beginning of for loop
default default case in switch
else false processing in if
fallthrough next case in switch statement
for loop
goto jump to labeled statement
if used a check certain condition
range iterate items over the list items like map
return return
select goroutine to wait during the simultaneous communication operations
switch used to start a loop and use the if-elf logic with in block
Funcion modifier defer used to defer the execution of a function. runs when leave the code block.
go run goroutine
Licensed under CC BY-NC-SA 4.0