Check out example codes for "safe cast golang". It will help you in understanding the concepts better.

Code Example 1

s, ok := v.(string)
if !ok {
    // the assertion failed.
}

// OR //

switch t := v.(type) {
case string:
    // t is a string
case int :
    // t is an int
default:
    // t is some other type that we didn't name.
}

Learn ReactJs, React Native from akashmittal.com