I have recently discovered that the microbit makecode editor requires to know the type of list before runtime. I have been using typehints to achieve this like so:
enemies: List[game.LedSprite] = []
however when trying to make a list of integers I could not get it to work
I have tried all of these:
purge: List[int] = []
purge: List[Number] = []
purge: List[Integer] = []
yet none of these work!
In order to make this work I need to use a really jank solution:
purge = [0]
purge.remove_at(0)
Surely there must be a way to do this with typehints, if you know please let me know.
Okay so strangely in a new project this works:
However when I try and use the exact same code in my project where I need this I get this three errors, āUnused labelā, āānumberā only refers to a type, but is being used as a value hereā and āExpression expected.ā
And now I think I found the problem, for some reason when you put it in a loop or maybe its just when you indent it these errors appear, but when not indented it works fine, very confusing.