logoalt Hacker News

pjmlptoday at 8:53 AM2 repliesview on HN

Delphi has allowed this for quite some time.


Replies

HexDecOctBintoday at 12:04 PM

Yeah, but then I'll have to deal with Embarcadero.

vintagedavetoday at 10:00 AM

Yes - OP, you can do this via inline vars and consts:

  begin
    var foo : string := 'hello';
    const c : integer = 5;
    var bar := GetBar(); // type inference even
    
    // and in blocks:
    for var i := low(x) to high(x) do...
  end;