Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,3 +1,7 @@
|
|||
Most programming languages offer support for [[Creating a function|subroutines]]. When execution changes between subroutines, different sets of variables and functions ("scopes") are available to the program. Frequently these sets are defined by the placement of the variable and function declarations ("static scoping" or "lexical scoping"). These sets may also be defined by special modifiers to the variable and function declarations.
|
||||
Most programming languages offer support for [[Creating a function|subroutines]].
|
||||
When execution changes between subroutines, different sets of variables and functions ("scopes") are available to the program.
|
||||
Frequently these sets are defined by the placement of the variable and function declarations ("static scoping" or "lexical scoping").
|
||||
These sets may also be defined by special modifiers to the variable and function declarations.
|
||||
|
||||
Show the different scope modifiers available in your language and briefly explain how they change the scope of their variable or function. If your language has no scope modifiers, note it.
|
||||
Show the different scope modifiers available in your language and briefly explain how they change the scope of their variable or function.
|
||||
If your language has no scope modifiers, note it.
|
||||
|
|
|
|||
21
Task/Scope-modifiers/Eiffel/scope-modifiers.e
Normal file
21
Task/Scope-modifiers/Eiffel/scope-modifiers.e
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
feature
|
||||
some_procedure(int: INTEGER; char: CHARACTER)
|
||||
local
|
||||
r: REAL
|
||||
i: INTEGER
|
||||
do
|
||||
-- r, i and s have scope here
|
||||
-- as well as int and char
|
||||
-- some_procedure and some_function additionally have scope here
|
||||
end
|
||||
|
||||
s: STRING
|
||||
|
||||
some_function(int: INTEGER): INTEGER
|
||||
do
|
||||
-- s and Result have scope here
|
||||
-- as well as int (int here differs from the int of some_procedure)
|
||||
-- some_procedure and some_function additionally have scope here
|
||||
end
|
||||
|
||||
-- s, some_procedure and some_function have scope here
|
||||
9
Task/Scope-modifiers/Ruby/scope-modifiers.rb
Normal file
9
Task/Scope-modifiers/Ruby/scope-modifiers.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class Demo
|
||||
#public methods here
|
||||
|
||||
protected
|
||||
#protect methods here
|
||||
|
||||
private
|
||||
#private methods
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue