Function calling a condition

Function calling a condition

I'm trying to set up a function to set a variable based on the current logged in user. 

void fuction_name()
{
    if (zoho.loginuser  ==  zoho.adminuser)
    {
        path = "path_1";
    }
    else
    {
        path = "path_2";
    }
}

But I'm not sure how to invoke this function when loading a form. The form will need to do things with the variable "path" but after invoking the function, it errors saying "variable path not defined". 

thisapp.function_name();
Single_Line=path;

What am I doing wrong?