Did you know: Initializing global variables?

Maybe not everyone knows that the global variables can be initialized the same way as the typed constants.

Please note that the global variables are EVIL if abused.

So if you have the variable in a global scope (unit) then you can initialize it using following construction:

var
  X: String = 'Your initial value';

This does not work for locally defined variables!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s