language/

directory
v0.0.0-...-38a5715 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0

Directories

Path Synopsis
arrays
example1
Sample program to show how to declare and iterate over arrays of different types.
Sample program to show how to declare and iterate over arrays of different types.
example2
Sample program to show how arrays of different sizes are not of the same type.
Sample program to show how arrays of different sizes are not of the same type.
example3
Sample program to show how the behavior of the for range and how memory for an array is contiguous.
Sample program to show how the behavior of the for range and how memory for an array is contiguous.
example4
Sample program to show how the for range has both value and pointer semantics.
Sample program to show how the for range has both value and pointer semantics.
exercises/exercise1
Declare an array of 5 strings with each element initialized to its zero value.
Declare an array of 5 strings with each element initialized to its zero value.
exercises/template1
Declare an array of 5 strings with each element initialized to its zero value.
Declare an array of 5 strings with each element initialized to its zero value.
constants
example1
Sample program to show how to declare constants and their implementation in Go.
Sample program to show how to declare constants and their implementation in Go.
example2
Sample program to show how constants do have a parallel type system.
Sample program to show how constants do have a parallel type system.
example3
Sample program to show how iota works.
Sample program to show how iota works.
example4
Sample program to show how literal, constant and variables work within the scope of implicit conversion.
Sample program to show how literal, constant and variables work within the scope of implicit conversion.
exercises/exercise1
Declare an untyped and typed constant and display their values.
Declare an untyped and typed constant and display their values.
exercises/template1
Declare an untyped and typed constant and display their values.
Declare an untyped and typed constant and display their values.
control_flow
example1
Sample program to show how to use if statements.
Sample program to show how to use if statements.
example2
Sample program to show how to use switch statements.
Sample program to show how to use switch statements.
exercises/exercise1
Write a program that inspects a user's name and greets them in a certain way if they are on a list or in a different way if they are not.
Write a program that inspects a user's name and greets them in a certain way if they are on a list or in a different way if they are not.
exercises/template1
Write a program that inspects a user's name and greets them in a certain way if they are on a list or in a different way if they are not.
Write a program that inspects a user's name and greets them in a certain way if they are on a list or in a different way if they are not.
embedding
example1
Sample program to show how what we are doing is NOT embedding a type but just using a type as a field.
Sample program to show how what we are doing is NOT embedding a type but just using a type as a field.
example2
Sample program to show how to embed a type into another type and the relationship between the inner and outer type.
Sample program to show how to embed a type into another type and the relationship between the inner and outer type.
example3
Sample program to show how embedded types work with interfaces.
Sample program to show how embedded types work with interfaces.
example4
Sample program to show what happens when the outer and inner type implement the same interface.
Sample program to show what happens when the outer and inner type implement the same interface.
exercises/exercise1
Sample program to show how you can use embedding to reuse behavior from another type and override specific methods.
Sample program to show how you can use embedding to reuse behavior from another type and override specific methods.
exercises/template1
This program defines a type Feed with two methods: Count and Fetch.
This program defines a type Feed with two methods: Count and Fetch.
exporting
example1
Sample program to show how to access an exported identifier.
Sample program to show how to access an exported identifier.
example1/counters
Package counters provides alert counter support.
Package counters provides alert counter support.
example2
Sample program to show how the program can't access an unexported identifier from another package.
Sample program to show how the program can't access an unexported identifier from another package.
example2/counters
Package counters provides alert counter support.
Package counters provides alert counter support.
example3
Sample program to show how the program can access a value of an unexported identifier from another package.
Sample program to show how the program can access a value of an unexported identifier from another package.
example3/counters
Package counters provides alert counter support.
Package counters provides alert counter support.
example4
Sample program to show how unexported fields from an exported struct type can't be accessed directly.
Sample program to show how unexported fields from an exported struct type can't be accessed directly.
example4/users
Package users provides support for user management.
Package users provides support for user management.
example5
Sample program to show how to create values from exported types with embedded unexported types.
Sample program to show how to create values from exported types with embedded unexported types.
example5/users
Package users provides support for user management.
Package users provides support for user management.
exercises/exercise1
Create a package named toy with a single exported struct type named Toy.
Create a package named toy with a single exported struct type named Toy.
exercises/exercise1/toy
Package toy contains support for managing toy inventory.
Package toy contains support for managing toy inventory.
exercises/template1
Create a package named toy with a single exported struct type named Toy.
Create a package named toy with a single exported struct type named Toy.
exercises/template1/toy
Package toy contains support for managing toy inventory.
Package toy contains support for managing toy inventory.
functions
advanced/example1
Sample program to show how to recover from panics.
Sample program to show how to recover from panics.
example1
Sample program to show how functions can return multiple values while using named and struct types.
Sample program to show how functions can return multiple values while using named and struct types.
example2
Sample program to show how we can use the blank identifier to ignore return values.
Sample program to show how we can use the blank identifier to ignore return values.
example3
Sample program to show some of the mechanics behind the short variable declaration operator redeclares.
Sample program to show some of the mechanics behind the short variable declaration operator redeclares.
example4
Sample program to show how anonymous functions and closures work.
Sample program to show how anonymous functions and closures work.
exercises/exercise1
Declare a struct type to maintain information about a user.
Declare a struct type to maintain information about a user.
exercises/template1
Declare a struct type to maintain information about a user.
Declare a struct type to maintain information about a user.
interfaces
advanced/example1
Sample program that explores how interface assignments work when values are stored inside the interface.
Sample program that explores how interface assignments work when values are stored inside the interface.
example0
Sample program that could benefit from polymorphic behavior with interfaces.
Sample program that could benefit from polymorphic behavior with interfaces.
example1
Sample program to show how polymorphic behavior with interfaces.
Sample program to show how polymorphic behavior with interfaces.
example2
Sample program to show how to understand method sets.
Sample program to show how to understand method sets.
example3
Sample program to show how you can't always get the address of a value.
Sample program to show how you can't always get the address of a value.
example4
Sample program to show how the concrete value assigned to the interface is what is stored inside the interface.
Sample program to show how the concrete value assigned to the interface is what is stored inside the interface.
example5
Sample program to show the syntax of type assertions.
Sample program to show the syntax of type assertions.
example6
Sample program to show type assertions using the comma-ok idiom.
Sample program to show type assertions using the comma-ok idiom.
example7
Sample program to show the syntax and mechanics of type switches and the empty interface.
Sample program to show the syntax and mechanics of type switches and the empty interface.
exercises/exercise1
Declare an interface named speaker with a method named speak.
Declare an interface named speaker with a method named speak.
exercises/template1
Declare an interface named speaker with a method named speak.
Declare an interface named speaker with a method named speak.
maps
example1
Sample program to show how to initialize a map, write to it, then read and delete from it.
Sample program to show how to initialize a map, write to it, then read and delete from it.
example2
Sample program to show how maps behave when you read an absent key.
Sample program to show how maps behave when you read an absent key.
example3
Sample program to show how only types that can have equality defined on them can be a map key.
Sample program to show how only types that can have equality defined on them can be a map key.
example4
Sample program to show how to declare, initialize and iterate over a map.
Sample program to show how to declare, initialize and iterate over a map.
example5
Sample program to show how to walk through a map by alphabetical key order.
Sample program to show how to walk through a map by alphabetical key order.
example6
Sample program to show that you cannot take the address of an element in a map.
Sample program to show that you cannot take the address of an element in a map.
example7
Sample program to show how maps are reference types.
Sample program to show how maps are reference types.
exercises/exercise1
Declare and make a map of integer values with a string as the key.
Declare and make a map of integer values with a string as the key.
exercises/template1
Declare and make a map of integer values with a string as the key.
Declare and make a map of integer values with a string as the key.
methods
example1
Sample program to show how to declare methods and how the Go compiler supports them.
Sample program to show how to declare methods and how the Go compiler supports them.
example2
Sample program to show how to declare methods against a named type.
Sample program to show how to declare methods against a named type.
example3
Sample program to show how to declare function variables.
Sample program to show how to declare function variables.
example4
Sample program to show how to declare and use function types.
Sample program to show how to declare and use function types.
exercises/exercise1
Declare a struct that represents a baseball player.
Declare a struct that represents a baseball player.
exercises/template1
Declare a struct that represents a baseball player.
Declare a struct that represents a baseball player.
pointers
example1
Sample program to show the basic concept of pass by value.
Sample program to show the basic concept of pass by value.
example2
Sample program to show the basic concept of using a pointer to share data.
Sample program to show the basic concept of using a pointer to share data.
example3
Sample program to show the basic concept of using a pointer to share data.
Sample program to show the basic concept of using a pointer to share data.
example4
Sample program to teach the mechanics of escape analysis.
Sample program to teach the mechanics of escape analysis.
example5
Sample program to show how stacks grow/change.
Sample program to show how stacks grow/change.
exercises/exercise1
Declare and initialize a variable of type int with the value of 20.
Declare and initialize a variable of type int with the value of 20.
exercises/exercise2
Declare a struct type and create a value of this type.
Declare a struct type and create a value of this type.
exercises/template1
Declare and initialize a variable of type int with the value of 20.
Declare and initialize a variable of type int with the value of 20.
exercises/template2
Declare a struct type and create a value of this type.
Declare a struct type and create a value of this type.
slices
advanced/example1
Sample program to show how to use a third index slice.
Sample program to show how to use a third index slice.
example1
Sample program to show how the capacity of the slice is not available for use.
Sample program to show how the capacity of the slice is not available for use.
example2
Sample program to show the components of a slice.
Sample program to show the components of a slice.
example3
Sample program to show how to takes slices of slices to create different views of and make changes to the underlying array.
Sample program to show how to takes slices of slices to create different views of and make changes to the underlying array.
example4
Sample program to show how to grow a slice using the built-in function append and how append grows the capacity of the underlying array.
Sample program to show how to grow a slice using the built-in function append and how append grows the capacity of the underlying array.
example5
Sample program to show how one needs to be careful when appending to a slice when you have a reference to an element.
Sample program to show how one needs to be careful when appending to a slice when you have a reference to an element.
example6
Sample program to show how strings have a UTF-8 encoded byte array.
Sample program to show how strings have a UTF-8 encoded byte array.
example7
Sample program to show how to declare and use variadic functions.
Sample program to show how to declare and use variadic functions.
example8
Sample program to show how the for range has both value and pointer semantics.
Sample program to show how the for range has both value and pointer semantics.
example9
Sample program to show how slices allow for efficient linear traversals.
Sample program to show how slices allow for efficient linear traversals.
exercises/exercise1
Declare a nil slice of integers.
Declare a nil slice of integers.
exercises/template1
Declare a nil slice of integers.
Declare a nil slice of integers.
struct_types
advanced/example1
Sample program to show how struct types align on boundaries.
Sample program to show how struct types align on boundaries.
example1
Sample program to show how to declare and initialize struct types.
Sample program to show how to declare and initialize struct types.
example2
Sample program to show how to declare and initialize anonymous struct types.
Sample program to show how to declare and initialize anonymous struct types.
example3
Sample program to show how variables of an unnamed type can be assigned to variables of a named type, when they are identical.
Sample program to show how variables of an unnamed type can be assigned to variables of a named type, when they are identical.
exercises/exercise1
Declare a struct type to maintain information about a user (name, email and age).
Declare a struct type to maintain information about a user (name, email and age).
exercises/template1
Declare a struct type to maintain information about a user (name, email and age).
Declare a struct type to maintain information about a user (name, email and age).
variables
example1
Sample program to show how to declare variables.
Sample program to show how to declare variables.
exercises/exercise1
Declare three variables that are initialized to their zero value and three declared with a literal value.
Declare three variables that are initialized to their zero value and three declared with a literal value.
exercises/template1
Declare three variables that are initialized to their zero value and three declared with a literal value.
Declare three variables that are initialized to their zero value and three declared with a literal value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL