Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
EnTerr
Roku Guru

Is doco wrong on ifEnum.isEmpty() ?

I am confused about isEmpty() on enumerables. RTFM implies isEmpty() is the opposite of isNext():
"ifEnum" wrote:
...
IsNext() as Boolean
Returns true if there is a next element

IsEmpty() as Boolean
Returns true if there is not a next element

But the two do not stay in sync:
BrightScript Debugger> a = [1]
BrightScript Debugger> ? a.isEmpty(), a.isNext()
false true
BrightScript Debugger> ? a.next()
1
BrightScript Debugger> ? a.isEmpty(), a.isNext()
false false

Seems that (and i am hoping that) the actual meaning is: isEmpty() returns whether the object has no elements (regardless of where next pointer currently is).

Is this correct? I am asking for realz, got a list - want to check if it is empty and o.isEmpty() sounds as a better/properer way than checking o.count() = 0.
0 Kudos
2 REPLIES 2
RokuMarkn
Visitor

Re: Is doco wrong on ifEnum.isEmpty() ?

You are correct. I've updated the doc.

--Mark
0 Kudos
EnTerr
Roku Guru

Re: Is doco wrong on ifEnum.isEmpty() ?

Much obliged!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.