Using scope variables

Литература по BASIC
Post Reply
User avatar
Mr. Kibernetik
Site Admin
Posts: 4609
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPad, iPhone, MacBook
Location: Russia
Flag: Russia

Using scope variables

Post by Mr. Kibernetik » Wed Oct 09, 2013 5:09 pm

One of implementation of scope variables is grouping of variables to virtual scopes.
It is not necessary that scope names can be only DEF function names. Your own scopes are created automatically when you declare scope variable.
For example, you can write:
SCR.WIDTH = SCREEN_WIDTH()
SCR.HEIGHT = SCREEN_HEIGHT()
This way you automatically create "SCR" scope. When you pause your program, all variables are listed grouped by their scopes, so you will see:
SCR:
WIDTH = …
HEIGHT = …
This approach can help you organize variables into scopes for better program layout.

Post Reply