Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
32
Task/Scope-modifiers/PureBasic/scope-modifiers.basic
Normal file
32
Task/Scope-modifiers/PureBasic/scope-modifiers.basic
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
;define a local integer variable by simply using it
|
||||
baseAge.i = 10
|
||||
;explicitly define local strings
|
||||
Define person.s = "Amy", friend.s = "Susan"
|
||||
;define variables that are both accessible inside and outside procedures
|
||||
Global ageDiff = 3
|
||||
Global extraYears = 5
|
||||
|
||||
|
||||
Procedure test()
|
||||
;define a local integer variable by simply using it
|
||||
baseAge.i = 30
|
||||
;explicitly define a local string
|
||||
Define person.s = "Bob"
|
||||
;allow access to a local variable in the main body of code
|
||||
Shared friend
|
||||
;create a local variable distinct from a variable with global scope having the same name
|
||||
Protected extraYears = 2
|
||||
|
||||
PrintN(person + " and " + friend + " are " + Str(baseAge) + " and " + Str(baseAge + ageDiff + extraYears) + " years old.")
|
||||
EndProcedure
|
||||
|
||||
|
||||
If OpenConsole()
|
||||
test()
|
||||
|
||||
PrintN(person + " and " + friend + " are " + Str(baseAge) + " and " + Str(baseAge + ageDiff + extraYears) + " years old.")
|
||||
|
||||
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit")
|
||||
Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue