If the first nonblank character of a command is #, the whole command up to the next newline is ignored. This usually means that the comment character is the first nonblank character on a line:
Comments after a command can be introduced with a semicolon, which ends the previous command and starts the next one:# now we set a global variable set a 1
set a 1 ;# we set the global variable