Files
Shell/docs/syntax/variables.cshtml
T
Mahmoud Gomaa 03401e25d8 Add files via upload
Change file names to lowercase
2021-12-28 00:00:20 +02:00

52 lines
1.8 KiB
Plaintext

@page
@{
ViewData["title"] = "Variables";
ViewData["page-support"] = "Variables";
}
<h4>Variables</h4>
<br>
<p>Variables are containers for storing data values.</p>
<ul>
<li>Global and local variables are optional.</li>
<li>To declare more than one variable, use a space.</li>
</ul>
<p>The general rules for constructing names for variables (unique identifiers) are:</p>
<ul>
<li>Names can contain letters, digits and underscores (<code>_</code>).</li>
<li>Names must begin with a letter.</li>
<li>Names cannot contain whitespaces or special characters like !, #, %, etc.</li>
<li>Reserved words (like keywords, such as null, true, false, etc.) cannot be used as names.</li>
<li>Variables can be placed in globle variables, or in the dynamic body section of an menu, or in both.</li>
</ul>
<p>
All variables must be identified with unique names.<br>
These unique names are called identifiers.
Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume).
</p>
<p><i>Note:</i> It is recommended to use descriptive names in order to create understandable and maintainable code</p>
<h5 class="mt-5">Example</h5>
<pre class="syntax"><code>shell
{
var
{
hello_world = <span class="syntax-string">'Hello World!'</span>
test_add1 = <span class="syntax-number">5</span> + <span class="syntax-number">6</span>
}
dynamic
{
item(title = <span class="syntax-code">@@hello_world</span> cmd = <span class="syntax-code">@@msg(hello_world)</span>)
menu(title = <span class="syntax-code">@@test_add1</span>)
{
var
{
test_sub1 = <span class="syntax-number">11</span> - <span class="syntax-number">5</span>
}
item(title = <span class="syntax-code">@@test_sub1</span>)
}
}
}</code></pre>