Nice to see that go lang also has a spread operator and the n parameter functionality. BUT couldnt I just pass the slice as slice or arr parameter like "func sum arr []int) {". Why should i use the spread syntax and not just use the arr as parameter.
Yes, you are right. I've actually explained this in the video. Generally, it's more convenient and readable for other developers, I think that is pretty clear. Also, it avoids creating unnecessary slices for each function call. That's especially useful for performance-critical code. I hope that makes sense :)
Nice to see that go lang also has a spread operator and the n parameter functionality. BUT couldnt I just pass the slice as slice or arr parameter like "func sum arr []int) {". Why should i use the spread syntax and not just use the arr as parameter.
Yes, you are right. I've actually explained this in the video.
Generally, it's more convenient and readable for other developers, I think that is pretty clear. Also, it avoids creating unnecessary slices for each function call. That's especially useful for performance-critical code.
I hope that makes sense :)
Great video, but brother please, bestow me with that font name, it looks gorgeous!
Thank you for the question. I do use the font Monaspace :)