« Back to Index

Code: Programming Terminology

View original Gist on GitHub

Tags: #programming #terminology

Programming Terminology in Go.md

Programming Terminology in Go

1. Expression


2. Statement


3. Directive


4. Declaration


5. Keyword


6. Block


7. Literal


8. Operator


9. Type


10. Function


11. Package


12. Import


13. Comment


Example Code with All Terms

// This is a package declaration (declaration)
package main

import "fmt" // Import statement

// Function declaration
func main() {
    var x int = 10 // Declaration statement
    const y = 20   // Constant declaration

    // Expression within an assignment statement
    result := x + y

    // Control flow statement
    if result > 15 {
        fmt.Println("Result is greater than 15") // Expression statement
    }

    // Function call within a block
    fmt.Println("End of program") // Directive example: //go:generate could appear here
}