Skip to content

Commit 5d57902

Browse files
IldySilvaparlough
andauthored
Add "Scope" term to glossary (#7091)
Contributes to #6461 --------- Co-authored-by: Parker Lougheed <parlough@gmail.com>
1 parent 91e7d32 commit 5d57902

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/data/glossary.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,39 @@
14211421
alternate:
14221422
- "matching contexts"
14231423

1424+
- term: "Scope"
1425+
short_description: |-
1426+
The region of a program where a name (such as a variable, function, or class)
1427+
is visible and can be referenced.
1428+
long_description: |-
1429+
**Scope** defines where identifiers—such as variables, parameters, functions,
1430+
and classes are accessible within a program.
1431+
1432+
Dart uses **lexical (static) scoping**, meaning that the scope of a name is
1433+
determined by the structure of the source code, not by how the program
1434+
executes at runtime. See
1435+
[lexical scope](/language/functions#lexical-scope) for more details.
1436+
1437+
Common kinds of scope in Dart include:
1438+
1439+
- **Class scope**: Members accessible within a class.
1440+
- **Block scope**: Variables declared inside blocks such as `if`, `for`,
1441+
or `while`.
1442+
- **Function scope**: Parameters and local variables inside a function.
1443+
- **Library scope**: Top-level declarations visible within a library.
1444+
1445+
related_links:
1446+
- text: "Variables"
1447+
link: "/language/variables"
1448+
type: "doc"
1449+
- text: "Functions and closures"
1450+
link: "/language/functions"
1451+
type: "doc"
1452+
labels:
1453+
- "language"
1454+
alternate:
1455+
- "Lexical scope"
1456+
14241457
- term: "Subclass"
14251458
short_description: |-
14261459
A class that inherits the implementation of another class.

0 commit comments

Comments
 (0)