Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
EnTerr
Level 8

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
RokuMarkn
Level 7

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

You are correct. I've updated the doc.

--Mark
0 Kudos
EnTerr
Level 8

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

Much obliged!
0 Kudos