You prefix the name of your variable with g:
.
You set it, from within a function for example, with let g:var_name = "something"
let g:global_var
function Hello
let g:global_var = "Hello"
endfunction
Yes, you use let
from within the function.
You can see the value of g:global_var
by issuing: :echo g:global_var
.