LWC Posted May 27, 2024 Posted May 27, 2024 (edited) On 4/16/2013 at 7:10 PM, iamtheky said: The below works, but is there a better way to determine if the object is empty rather than counting elements? I know it's an old thread, but it seems the focus was on a very specific object, so the general issue still remains unsolved. I ask in general, where the keys are named dynamically so I can't test their existence, how to know if the object is empty i.e. the object has no keys? The aforementioned loop is the only way I managed to find, but at least I've shortened it to just 1 iteration instead of an unneeded count: Local $key, $found = False For $key in $myObj $found = True ExitLoop Next If Not $found Then ConsoleWrite("Object is empty" & @CRLF) EndIf Edited October 16, 2024 by LWC Used capital letters
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now