Variable scope between forms

How does one declare a variable to be global to all forms in a project? Tried declaring variable at project level, not using a ‘var’ (using JS) to no avail. Ideas?

If you declare a variable outside of any function, it becomes global.

So, you could do this:

var myGlobal = 'some string';
... the rest of the code for your project

Note that polluting the global namespace is generally frowned on.

What’s the best practice for passing multiple variables back from a function? I know it’s easy to pass several values to a function ie: calc_function (var1, var2, var3). But I need to receive back several variables from the function.

In BASIC or JavaScript?

Thanks! It is JavaScript.


Here’s a good article showing a number of ways to do this:

1 Like

Thanks! I’ll pass this on to my students. Much appreciated.