generated docs added
This commit is contained in:
98
doc/doc_files/scope.html
Normal file
98
doc/doc_files/scope.html
Normal file
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
table, th, td { border: 1px solid black; } th, td { padding: 10px; }
|
||||
body { background-color: #064066; color: #FFFFFF; }
|
||||
a { color: #40bfb8; }
|
||||
a::before {
|
||||
content: "---";
|
||||
font-family: monospace, monospace;
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
color: #064066;
|
||||
}
|
||||
|
||||
.rc_number { color: #0b9898; }
|
||||
.rc_string { color: #dd4040; }
|
||||
.rc_keyword { color: #6084a8; font-weight: bold; }
|
||||
.rc_comment { color: #6e716e; }
|
||||
#rc_code { font-family: Consolas,"courier new"; background-color: #2d3335; padding: 2px; font-size: 105%; }
|
||||
|
||||
|
||||
ul, #myUL {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#myUL {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.box {
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none; /* Safari 3.1+ */
|
||||
-moz-user-select: none; /* Firefox 2+ */
|
||||
-ms-user-select: none; /* IE 10+ */
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.box::before {
|
||||
content: "[+]";
|
||||
font-family: monospace, monospace;
|
||||
font-weight: bold;
|
||||
color: #40bfb8;
|
||||
display: inline-block;
|
||||
margin-right: 6px;
|
||||
}
|
||||
|
||||
.box {
|
||||
font-weight: bold;
|
||||
color: #40bfb8;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.check-box::before {
|
||||
content: "[-]";
|
||||
font-family: monospace, monospace;
|
||||
font-weight: bold;
|
||||
//color: dodgerblue;
|
||||
color: #40bfb8;
|
||||
}
|
||||
|
||||
.nested {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
|
||||
<title>RCBasic Scope [RCBasic Doc] </title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p><h1>SCOPE </h1></p>
|
||||
<p>
|
||||
Scope refers to where you are able to access a variable. Basically variables cannot be accessed from outside the scope they are created in. Look at the following:
|
||||
</p>
|
||||
<p id="rc_code"><code>
|
||||
A = <span class="rc_number">5</span> <br>
|
||||
<br>
|
||||
<span class="rc_keyword">While</span> A < <span class="rc_number">10</span> <br>
|
||||
B = <span class="rc_number">1</span> <span class="rc_comment">'----- B is created inside this loop and cannot be accessed outside of this loop </span><br>
|
||||
A = A + <span class="rc_number">1</span> <span class="rc_comment">'----- A was created before this loop started so it will be able to be used after this loop ends </span><br>
|
||||
<span class="rc_keyword">Wend</span> <br>
|
||||
<br>
|
||||
<span class="rc_keyword">Print</span> B <br>
|
||||
</code></p>
|
||||
<p>
|
||||
The above program WILL NOT COMPILE. That is because the variable B was created inside the scope of the WHILE loop and nothing outside the WHILE loop will be able to access it. The variable A was created outside the WHILE loop so the variable A could be used anywhere in this example. So a variable can go into a deeper scope than where it was created but it cannot go to a lesser scope than where it was created. A scope deepens every time a new block is started. Blocks refer to the code within a loop, within a Function, or within a Sub Routine.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user