ExampleCreate demonstrates creating a set with initial values
()
| 245 | |
| 246 | // ExampleCreate demonstrates creating a set with initial values |
| 247 | func ExampleCreate() { |
| 248 | // Create set with initial values |
| 249 | primes := set.Create(2, 3, 5, 7, 11, 13) |
| 250 | |
| 251 | fmt.Println("Is 7 prime:", primes.Contains(7)) |
| 252 | fmt.Println("Is 9 prime:", primes.Contains(9)) |
| 253 | fmt.Println("Prime count:", len(primes)) |
| 254 | |
| 255 | // Output: |
| 256 | // Is 7 prime: true |
| 257 | // Is 9 prime: false |
| 258 | // Prime count: 6 |
| 259 | } |
| 260 | |
| 261 | // ExampleSet_complexCustomType demonstrates using Set with a complex comparable struct |
| 262 | func ExampleSet_complexCustomType() { |