Working with Constants and iota in Go.
The Constant Generator iota
Here’s an example from the time package, which defines named constants of type Weekday for the days of the week, starting with zero for Sunday. Types of this kind are often called en...
Calculate degrees celcius from farenheit in Go.
Following program shows you how to convert fahrenheit to celsius.
The function FToC below encapsu- lates the temperature conversion logic so that it is defined only once but may be used from multiple p...
In Golang, using the os.O_APPEND flag is the easiest way to append text to a file
Using os.OpenFile Function
OpenFile is the generalized open call; most users will use Open or Create instead. It opens the named file with specified flag (O_RDONLY etc...
In Golang, there are 2 ways to get the maximum value for an int type.
Using constant values
Since integer types use two's complement arithmetic, you can infer the min/max constant values for int and uint. For example,
package main
import (
"...
In Golang, there are two ways to format the time.The layout string
Go doesn’t use yyyy-mm-dd layout to format a time. Instead, you format a special layout parameter.
2006-01-02 15:04:05.999999999 -0700 MST
package main
import (
"fmt"
"tim...
Python Examples of zlib.crc32Cyclic redundancy check
A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to detect accidental changes to digital data.
Using zlib.crc32 Function
Computes a C...
String Constants Best Practice.String Constants in Python
The constants defined in this module are:
String constants:
string.ascii_lettersThe concatenation of the ascii_lowercase and ascii_uppercase constants described below. This value is not locale...
List of Golang Keywords.
Keywords
The following keywords are reserved and may not be used as identifiers.
break default func interface select
case defer go map struct
chan else goto package switch
const ...