Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func in(list interface{}, val interface{}) bool {
- listVal := reflect.ValueOf(list)
- //need to find a way instead of hardcoding datatype get the data type accordingly
- //from list to convert it easily
- actualList := listVal.Interface().([]int)
- for i := 0; i < len(actualList); i++ {
- if actualList[i] == val {
- return true
- }
- }
- return false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement