0x00


12 Nov 17 - 18:10

Using well defined bytes to categorise data, can be very efficient. As opposed to strings or integers.

i.e.

var status = 0x00 // This means the data is perhaps not ready to be processed?

// Check if the data is ready to be processed
dataReady(&status)

if status == 0x00 {
    fmt.Println("Status is 0 and this means we need to perform x")
} else if status == 0x01 {
    fmt.Println("Status is 1 and this means we need to perform y")
}

// dataReady sets status == 0x01
func dataReady(status *byte) {
    *status = 0x01
}


Archives