With Each <UDT-array-name> ... End With
issueid=521 21-08-2016 11:23
thinBasic MVPs
Number of reported issues by ReneMiner: 75
With Each <UDT-array-name> ... End With

I'd like to suggest the following:

Assume an UDT-array as this
Type t_Starship
  posX As Single
  posY As Single
  Function Animate()
  End Function

  Function Render()
  End Function
End Type

Dim player(123) As t_Starship

With Each player
  ' ...
End With
Issue Details
Issue Number 521
Issue Type Feature
Project thinBasic
Category Unknown
Status Suggested
Priority Unknown
Suggested Version 2.0
Implemented Version (none)
Milestone (none)
Votes for this feature 0
Votes against this feature 0
Assigned Users (none)
Tags (none)

23-02-2018 09:29
thinBasic MVPs
Maybe this syntax is better to realize?
With {Each | All} {t_Starship In Player() | Player {As t_Starship}}
End With
I mean it's somewhat like For Each ... except it's for UDTs and saves us to type the udt-elements name as well as the interpreter can stay "absolute virtual" on the current element until End With encountered...

Great also were if single elements like this:

With t_Starship At pData
End With

09-03-2018 08:41
thinBasic author
Nice suggestion but so far quite complex to develop.
I will leave here

If I will be able to develop FOR EACH .... then I will check WITH EACH ...

+ Reply