emersonmacro pfp
emersonmacro
@emerson
Tried asking ChatGPT a programming question, and it gave me two suggestions that seemed plausible but were actually quite wrong. The prompt was `golang check if element in slice` (a slice is basically an array).
1 reply
0 recast
0 reaction

emersonmacro pfp
emersonmacro
@emerson
The first answer was `if <element> in <slice>`, which is valid Python but not valid Go. The second was `if strings.Contains(<slice>, <element>)`. There is a `strings` package that has a `Contains` method, but it's to check if a substring is in the input string.
1 reply
0 recast
0 reaction