Go Pages

Dot Net Perls has example pages for many languages, with explanations and code side by side (for easy understanding).
Map. Use maps to provide lookups from keys to values. Get values and delete them.Golang Map Examples
2D slice, array. Use 2D slices and arrays. Nest slices and arrays to create multiple dimensions.Golang 2D Slices and Arrays
Array. Use arrays with int and string elements. Iterate over an array with a for-loop.Golang Array Examples
Built-ins. Review built-in functions in Golang. See examples of how these built-ins are used.Golang Built In Functions
Bytes. Use byte slices and the bytes package. Manipulate, test and benchmark byte slices.Golang Bytes: Slices and Methods
Consts. Use the const and var keywords. Generate constants with the iota enumerator.Golang Const, Var Examples: Iota
Conversion, strconv. Cast numeric types and convert values to strings. Perform map and slice conversions.Golang strconv, Convert Int to String
CSV. Use the encoding-cvs package. Call NewReader and Read to read records.Golang csv Examples: NewReader and ReadAll
File, bufio. Use bufio, NewScanner, Scan and Text to read the lines of a file. Call ioutil.ReadAll.Golang Read Text File: bufio, ioutil.ReadAll Examples
Flag. Use the flag package for command-line arguments. Pass ints and String arguments.Golang flag, Command Line Int, String Examples
Fmt, printing. Use the fmt package to write values to the console. Call Println and Sprintf.Golang fmt.Println, Sprintf: Console Programs
For-loop. Use the for-loop to iterate through numbers. Look at foreach and while loops.Golang for Loop Examples: Foreach and While
Func. Create methods with the func keyword. See arguments and multiple return values.Golang Func Examples
If. Use if, else if and else statements to test values. See correct syntax.Golang If, Else Statements
JSON. Use the encoding/json library to convert Go objects to JSON. Call Marshal and Unmarshal.Golang JSON Example: Marshal, Unmarshal
Len. Use the len built-in function to get string lengths. Len supports arrays, slices and maps.Golang Len (String Length)
Math. Perform mathematical computations with the math module. Call math.Abs and math.Pow.Golang Math Module: math.Abs, Pow
ParseInt. Use the strconv package and the ParseInt and Atoi funcs. Convert strings to ints.Golang ParseInt Examples: Convert String to Int
Rand. Use the rand package and generate random numbers. Call rand.Int and Seed.Golang rand, crypto: Random Number Generators
Regexp. Use the regexp package for regular expressions. Call MatchString and compile patterns.Golang Regexp Examples: MatchString, MustCompile
Remove duplicates. Use maps, and slices, to remove duplicate elements from slices of ints and strings.Golang Remove Duplicates From Slice
Replace. Use strings.Replace, in the strings package, to modify strings. Call NewReplacer.Golang Replace String Examples: Replacer, NewReplacer
Slice. Use slices to store elements. Call the append, cap and make functions.Golang Slice Examples (append, cap and make)
Sort. Use the sort package and sort elements. Invoke the Strings and Sort methods.Golang Sort Slice: Len, Less, Swap in Interface
Split. Use Split from the strings package. Call SplitAfter and SplitN to separate strings.Golang Split Examples (SplitAfter, SplitN)
Strings. Explore the strings package. The methods in strings create, test and modify string data.Golang Strings
Struct. Create structs to store fields and methods together. Use the new keyword.Golang Struct Examples: Types and Pointers
Substring, string slice. Use string slice syntax to take substrings. Take rune slices to handle more characters.Golang Substring Examples (Rune Slices)
Switch. Use switch, with expressions and case lists, to test variables and return values.Golang Switch Examples: case, break and fallthrough
Time. Use the time package to get and modify times. Get Now, Year, Month and Day.Golang Time: Now, Parse and Duration
© 2007-2019 Sam Allen. Every person is special and unique. Send bug reports to
Dot Net Perls