Jump to content
dormky

"for i in" goes in reverse

Recommended Posts

18 minutes ago, dormky said:

What the ****?

Please keep the profanity out.

Delphi treats the constant in that statement as a set. See this.

  • Like 5

Share this post


Link to post

A workaround would be to declare the array as a constant or create a dynamic array on the fly:

for I in TArray<Integer>.Create(45, 30, 15) do

 

  • Like 1

Share this post


Link to post

Why oh why would you write a for statement like that?

 

As others already said, you're declaring a set, so you are getting the expected behavior. I presume in your mind you expect it to be treated like an array. If that is the case, then you need to use an array instead of a set.

Share this post


Link to post
Posted (edited)

In cases like this, I really love code editors and environments that can tell me right away to what type something infers by just tapping Ctrl+Alt...

1983398469_Recording2024-07-11at18_59_26.thumb.gif.f0f3b1187b673d2bc4c416ed59adf94e.gif

 

Edited by Der schöne Günther

Share this post


Link to post
12 hours ago, Der schöne Günther said:

In cases like this, I really love code editors and environments that can tell me right away to what type something infers by just tapping Ctrl+Alt...

1983398469_Recording2024-07-11at18_59_26.thumb.gif.f0f3b1187b673d2bc4c416ed59adf94e.gif

 

Code editors telling you stuff is great but the bigger problem is the missing functionality at the fundamental language level. 

  • Like 1

Share this post


Link to post
On 7/11/2024 at 9:50 PM, David Heffernan said:

Classic delphi type ambiguity consequence

Yes, it would be much better if sets has a different punctuation from arrays. Sets came first though, and they got [ and ] on a first come first choose basis. If Delphi could yield { and } from comments and give it to arrays or sets, life would be better.

Share this post


Link to post
On 7/12/2024 at 3:05 PM, David Heffernan said:

Code editors telling you stuff is great but the bigger problem is the missing functionality at the fundamental language level. 

Yes, definitely. XCode does that, and you need it. 

Share this post


Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×