Hi
I am new to EFS and am having a problem with very simple code. I understand the logic but my code is not working.


Firstly the below code works:

***************
function main(){
x = getMostRecentAsk();
debugPrintln(x)}
***************
This means that x can not be used anywhere else, right?

However the below does not. So x can only be used inside the curly bracket, but this doesn't seem logical. It should be used anywhere right?

***************
function main(){
x = getMostRecentAsk();
}
debugPrintln(x)
***************

I believe it is because of the curly second bracket but could some explain why the error occurs.
Also if i write the below code why is x should be a global variable and thus should this should work, but again it does not.

***************
function preMain(){
}
var x;
function main(){
x = getMostRecentAsk();

debugPrintln(x)}
***************

I would really appreciate the help.