In my code I use Julia's prod() function to do a product over the elements of a list. However, sometimes that list is empty, in which case I want prod(myList) to just return 0 (or any fixed number like 1). I tried searching online, but the only things I could find were for iterators or stuff like that.
I'm using Julia version 1.5.2.
eltype(MyList)give when that list is empty? As mentioned in the comments, I thinkprodis the right function to use without modification and that the real issue may be how you create that empty list. - Benoit Pasquier