logo-MindMajix
PostGoLangGoLang
A
Altaf syed

Posted on 26th July 2024|29 views

0
votes

Golang Slice Contains

Is there any equivalent to slice.contains(object) method in Go?

1 answers
Answers
P
rushi chowdary

Posted on 26th July 2024| views

No, such a method does not endure, however, is useless to write:

func contains(r []int, p int) bool {

for _, x := range r {

if x == p {

return true

} } return false }

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number