nielsAD / lape

Scripting engine with Pascal-like syntax for FPC and Delphi
118 stars 28 forks source link

Inline Variable Declaration #199

Closed thecocce closed 4 months ago

thecocce commented 4 months ago

Hi, is there the possibility to implement the "Inline Variable Declaration" lilke recent Delphi compiler?

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Inline_Variable_Declaration

Thanks.

ollydev commented 4 months ago

I believe {$extendedsyntax on} supports that

ollydev commented 4 months ago

Example here: https://github.com/nielsAD/lape/blob/a02690f1b8992d4c5be326a5292a373bc83f63e8/tests/Algorithms/Death-Star.lap#L23

they're not scoped though, iirc it just allows you declare variables outside of the methods var block.

thecocce commented 4 months ago

Ty....