SlideShare a Scribd company logo
Development with Go
- Manjitsing K. Valvi
Basic constructs
1. Filenames
● Lower case letters
● ‘_’ allowed
● spaces or any other special characters not allowed
Basic constructs
2. Identifiers
● Case-sensitive
● begin with a letter (a letter is every letter in Unicode UTF-8 or _ ),
● followed by 0 or more letters or Unicode digits
○ like: X56, group1, _x23, i, өԑ12
● Keywords and operators not allowed
● ‘_’ : the blank identifier
● Sometimes variables, types or functions have no name
Basic constructs
3. Keywords
● 25 keywords or reserved words in GO
● kept deliberately small to simplify the code-parsing
● A keyword cannot be used as an identifier
Basic constructs
Functions
● format: func functionName()
● no, one, or more parameters (separated by , ) can be given as input to
the function inside parentheses
● A main function as starting is required
● main has no parameters and no return type
● Function body is enclosed between braces: { }
● The first { must be on the same line as the func-declaration
○ imposed by the compiler and gofmt
● The last } is positioned after the function-code in the column beneath
function
● Name PasalCasing => to be used outside function
Basic constructs
Functions - format
func functionName(parameter_list) (return_value_list) {
...
}
where parameter_list is of the form (param1 type1, param2 type2, ...)
and
return_value_list is of the form (ret1 type1, ret2 type2, ...)
Basic constructs
Comments
● One line : //
● Block : /* …
*/
● a package comment, provides information relevant to the package and
its functionality as a whole (using godoc)
Installation (shown for Windows)
Download the installer of GO and follow the steps
STEP 1
STEP 2
STEP 3
STEP 4
STEP 5
STEP 6
Basic constructs  i
References
● “The Way to Go: A Thorough Introduction to the Go Programming Language”, Ivo Balbaert
● “The Go Programming Language”, Alan Donovan, Brian Kernighan, Addison-Wesley

More Related Content

PDF
Introduction to golang
PDF
Pointers & functions
PDF
Composite types
PDF
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
PDF
Cap'n Proto (C++ Developer Meetup Iasi)
PPTX
Learn To Code: Introduction to c
PPT
JavaScript Introductin to Functions
PDF
Effective PHP. Part 5
Introduction to golang
Pointers & functions
Composite types
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Cap'n Proto (C++ Developer Meetup Iasi)
Learn To Code: Introduction to c
JavaScript Introductin to Functions
Effective PHP. Part 5

What's hot (20)

PPTX
Learn To Code: Introduction to java
PPTX
Introduction to JavaScript
PDF
Effective PHP. Part 3
PDF
Client sidescripting javascript
PDF
Effective PHP. Part 6
PDF
Introduction to clojure
PPTX
Learn To Code: Diving deep into java
PDF
JavaScript: Patterns, Part 3
PDF
overview of c#
PDF
Functional Programming 101 for Java 7 Developers
PPTX
Unit 3(rdbms)
PDF
Getting Fired with Java Types
PPTX
Storage classes in C
PPTX
Programming in python - Week 7,8
ODP
Programming basics
ODP
Specifications pattern
PPTX
Storage classes in C
PPTX
Storage Classes and Functions
PPTX
Storage class in c
PDF
Functional programing in Javascript (lite intro)
Learn To Code: Introduction to java
Introduction to JavaScript
Effective PHP. Part 3
Client sidescripting javascript
Effective PHP. Part 6
Introduction to clojure
Learn To Code: Diving deep into java
JavaScript: Patterns, Part 3
overview of c#
Functional Programming 101 for Java 7 Developers
Unit 3(rdbms)
Getting Fired with Java Types
Storage classes in C
Programming in python - Week 7,8
Programming basics
Specifications pattern
Storage classes in C
Storage Classes and Functions
Storage class in c
Functional programing in Javascript (lite intro)
Ad

Similar to Basic constructs i (20)

PDF
Effective Go
PDF
Golang workshop
PDF
Go_ Get iT! .pdf
PDF
The GO programming language
PPTX
Golang - Overview of Go (golang) Language
PPTX
Lab1GoBasicswithgo_foundationofgolang.pptx
PPTX
Google GO
PPTX
Introduction to Go
PDF
Introduction to Programming in Go
PPTX
Should i Go there
PDF
Go Programming by Example_ Nho Vĩnh Share.pdf
PPTX
Go Language Hands-on Workshop Material
PDF
Go for SysAdmins - LISA 2015
PDF
Introduction to Go language
PPTX
Introduction to go lang
PPTX
Golang introduction
PPT
Introduction to Go ProgrammingLanguage.ppt
PDF
Golang
PPTX
Golang iran - tutorial go programming language - Preliminary
PDF
Coding in GO - GDG SL - NSBM
Effective Go
Golang workshop
Go_ Get iT! .pdf
The GO programming language
Golang - Overview of Go (golang) Language
Lab1GoBasicswithgo_foundationofgolang.pptx
Google GO
Introduction to Go
Introduction to Programming in Go
Should i Go there
Go Programming by Example_ Nho Vĩnh Share.pdf
Go Language Hands-on Workshop Material
Go for SysAdmins - LISA 2015
Introduction to Go language
Introduction to go lang
Golang introduction
Introduction to Go ProgrammingLanguage.ppt
Golang
Golang iran - tutorial go programming language - Preliminary
Coding in GO - GDG SL - NSBM
Ad

More from Manjitsing Valvi (14)

PDF
Basic types
PDF
Basic constructs ii
PDF
Features of go
PDF
Error handling
PDF
Operators
PDF
PDF
Digital marketing marketing strategies for digital world
PDF
Digital marketing channels
PDF
Digital marketing techniques
PDF
Social media marketing & managing cybersocial campaign
PDF
Creating marketing effective online store
PDF
Social media marketing tech tools and optimization for search engines
PDF
Digital marketing managing cybersocial campaign
PDF
Social media marketing
Basic types
Basic constructs ii
Features of go
Error handling
Operators
Digital marketing marketing strategies for digital world
Digital marketing channels
Digital marketing techniques
Social media marketing & managing cybersocial campaign
Creating marketing effective online store
Social media marketing tech tools and optimization for search engines
Digital marketing managing cybersocial campaign
Social media marketing

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
DOCX
573137875-Attendance-Management-System-original
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Well-logging-methods_new................
PPTX
web development for engineering and engineering
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Construction Project Organization Group 2.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
PPT on Performance Review to get promotions
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Sustainable Sites - Green Building Construction
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
R24 SURVEYING LAB MANUAL for civil enggi
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
Foundation to blockchain - A guide to Blockchain Tech
Safety Seminar civil to be ensured for safe working.
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
573137875-Attendance-Management-System-original
Lecture Notes Electrical Wiring System Components
Well-logging-methods_new................
web development for engineering and engineering
Internet of Things (IOT) - A guide to understanding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Construction Project Organization Group 2.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPT on Performance Review to get promotions
additive manufacturing of ss316l using mig welding
Sustainable Sites - Green Building Construction
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...

Basic constructs i

  • 1. Development with Go - Manjitsing K. Valvi
  • 2. Basic constructs 1. Filenames ● Lower case letters ● ‘_’ allowed ● spaces or any other special characters not allowed
  • 3. Basic constructs 2. Identifiers ● Case-sensitive ● begin with a letter (a letter is every letter in Unicode UTF-8 or _ ), ● followed by 0 or more letters or Unicode digits ○ like: X56, group1, _x23, i, өԑ12 ● Keywords and operators not allowed ● ‘_’ : the blank identifier ● Sometimes variables, types or functions have no name
  • 4. Basic constructs 3. Keywords ● 25 keywords or reserved words in GO ● kept deliberately small to simplify the code-parsing ● A keyword cannot be used as an identifier
  • 5. Basic constructs Functions ● format: func functionName() ● no, one, or more parameters (separated by , ) can be given as input to the function inside parentheses ● A main function as starting is required ● main has no parameters and no return type ● Function body is enclosed between braces: { } ● The first { must be on the same line as the func-declaration ○ imposed by the compiler and gofmt ● The last } is positioned after the function-code in the column beneath function ● Name PasalCasing => to be used outside function
  • 6. Basic constructs Functions - format func functionName(parameter_list) (return_value_list) { ... } where parameter_list is of the form (param1 type1, param2 type2, ...) and return_value_list is of the form (ret1 type1, ret2 type2, ...)
  • 7. Basic constructs Comments ● One line : // ● Block : /* … */ ● a package comment, provides information relevant to the package and its functionality as a whole (using godoc)
  • 8. Installation (shown for Windows) Download the installer of GO and follow the steps
  • 13. References ● “The Way to Go: A Thorough Introduction to the Go Programming Language”, Ivo Balbaert ● “The Go Programming Language”, Alan Donovan, Brian Kernighan, Addison-Wesley