Can I declare variables in a string instead of a function?

I used visual baseline about 5 years ago.

but I started using delphi 5 years ago (when most developers switched from delphi to visual studio), delphi is as simple as vb, and at the same time it is happy and reliable. Delphi has many changes since pascal (for example: strings should be combined differently in pascal instead of just using +) to speed up script execution.

but why in delphi do we have to declare var from above when I write a lot of statements for a procedure that I have to scroll up and declare var and go down again. delphi is one of the best (several times one and only) MOST RAPID'est 'IDE in the world, but why they did not give support to declare a variable anywhere, like in vb C #, etc.

+3
source share
4 answers

You can declare var in the middle of a procedure using a code template, and is also enabled by default using Live templates in newer versions of Delphi.

I just type varand then press CTRL + J and type in a name, and the IDE type does the rest.

I have nothing to do.

Demonstration of Mike Rozlog live templates:

http://edn.embarcadero.com/article/40284

+16

, , , .

, Delphi .

+15

, Jens 'Ctrl-J.

  • , :

    I := 0;
    
  • , "I" ( , ).

  • "I" : Shift + Ctrl + V

  • declare, , , .

  • enter, .

.

+10

: " , vb # .."

: , inline . , . , .

, , Pascal.

+9

Source: https://habr.com/ru/post/1773883/


All Articles