$$Include{docs/siteMacros.textCarver}

# Arguments
When you use variables, you can pass arguments to them:

$$example{}
\$\$hello = {{
Hello, \$\$Args{}
}}
\$\$hello{Alex}

$$exampleRight{}
Hello, Alex

$$endExample{}

What’s the difference between a variable and a macro? Technically, there isn’t one. We like to refer to simple variables as variables and complex variables that take arguments as macros.


### Accessing individual arguments
You can access individual arguments:

$$example{}
\$\$hello = {{
Hello, \$\$Args[0] and \$\$Args[1]
}}
\$\$hello{Alex | Blair}

$$exampleRight{}
Hello, Alex and Blair

$$endExample{}


### Named arguments
You can name arguments:

$$example{}
\$\$hello = {{
Hello, Mx. \$\$Args.first{} \$\$Args.last{}
}}
\$\$hello{|.first Alex |.last Bobo}

$$exampleRight{}
Hello, Mx. Alex Bobo

$$endExample{}


### Testing for the presence of arguments
You can change the behavior of a macro based on whether an argument is present:

$$example{}
\$\$hello = {{
\$\$IfNotEmpty{\$\$Args.strong{}}
Hello, my good friend \$\$Args[0]{}
\$\$Else{}
Hello, \$\$Args[0]{}
\$\$EndIf{}
}}
\$\$hello{Alex}
\$\$hello{Alex |.strong true}

$$exampleRight{}
Hello, Alex
Hello, my good friend Alex

$$endExample{}


### Testing for the number of arguments
You can use \$\$IfNumArgs to change the behavior of a macro based on how many arguments are passed to it:

$$example{}
\$\$hello = {{
\$\$IfNumArgs{1}
Hello, \$\$Args[0]{}
\$\$ElseIfNumArgs{2}
Hello, \$\$Args[0]{} and \$\$Args[1]{}
\$\$EndIf{}
\$\$hello{Alex}
\$\$hello{Alex | Blair}

$$exampleRight{}
Hello, Alex
Hello, Alex and Blair

$$endExample{}



[Next: Other Commands](2dOtherCommands.html)
