WikiVariable
[{SET myvar1='[{$pagename}]'}] Show myvar1: [{$myvar1}]\\ [{SET myvar2='{$pagename}'}] Show myvar2: [{$myvar2}]
produces this
Show myvar1: HowToAssignAVariable Show myvar2: HowToAssignAVariable
Show myvar2: HowToAssignAVariable
Using variables
WikiVariable