Jump to content

global variable or function?


pcjunki
 Share

Recommended Posts

I'm redesigning one of my gui's , it has allot of buttons

I took a hard look, and saw that I have duplicate code that sets fonts and what not

I'd like to create a global variable, or would it be a function?

I'm trying to set properties for the cursor, font, and resizing of the gui button

btw, this is my first time using global variables, but I have an idea of what they are

$Form1 = GUICreate("PC TOOLS V2", 1001, 724, 147, 131, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP, $WS_HSCROLL, $WS_VSCROLL))
$Tab1 = GUICtrlCreateTab(8, 8, 1257, 985)


Global $cursor = "GUICtrlSetCursor(-1, 0)"
Global $font = "GGUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")"
Global $resize = "GUICtrlSetResizing ( -1, 1)"



$TabSheet1 = GUICtrlCreateTabItem("WOL")

$Button1 = GUICtrlCreateButton("1stFloor", 24, 56, 179, 153)
$cursor
$font
$resize






GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Link to comment
Share on other sites

All that code can be in a function and the variables declared as Local. I would also recommend using ExitLoop and then GUIDelete() at the end to tidy resources (even though AutoIt does this for you automagically!)

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I'm feeling generous

#include <GUIConstants.au3>
 
Global $Form1, $Tab1, $Button1

GUI()

While 1
    $msg = GUIGetMsg()
    Switch $msg
       Case $GUI_EVENT_CLOSE
          Exit
       Case $Button1
          ; do something here
    EndSwitch
WEnd

Func GUI()
    $Form1 = GUICreate("PC TOOLS V2", 1001, 724, 147, 131, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP, $WS_HSCROLL, $WS_VSCROLL))
    $Tab1 = GUICtrlCreateTab(8, 8, 1257, 985)
    Local $TabSheet1 = GUICtrlCreateTabItem("WOL")
    $Button1 = GUICtrlCreateButton("1stFloor", 24, 56, 179, 153)
    Local $cursor = GUICtrlSetCursor(-1, 0)
    Local $font = GUICtrlSetFont($Button1, 14, 400, 0, "MS Sans Serif")
    Local $resize = GUICtrlSetResizing($Button1, 1)
EndFunc
 

Something like this?

EDIT:

The difference between local and global..

Local: means that it will only be in the scope of the script, if declared outside of a function, or if declared in a function can only be used in that function.

Global: Once declared can be used anywhere that is linked to that particular script that it has been declared by. If declared again in another script or function, the original will be overwritten.

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

pcjunki,

I suppose you could do something like...

; *** Start added by AutoIt3Wrapper ***
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
; *** End added by AutoIt3Wrapper ***

#AutoIt3Wrapper_Add_Constants=n



$Form1 = GUICreate("PC TOOLS V2", 1001, 724, 147, 131, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP, $WS_HSCROLL, $WS_VSCROLL))
$Tab1 = GUICtrlCreateTab(8, 8, 1257, 985)


Global $cursor = "GUICtrlSetCursor(-1, 0)"
Global $font = "GUICtrlSetFont(-1, 14, 400, 0, ""MS Sans Serif"")"
Global $resize = "GUICtrlSetResizing ( -1, 1)"



$TabSheet1 = GUICtrlCreateTabItem("WOL")

$Button1 = GUICtrlCreateButton("1stFloor", 24, 56, 179, 153)
execute($cursor)
execute($font)
execute($resize)






GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

but it is not saving alot and is far less readable.

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

I code like this sometimes, when I'm bored.

Global $hGui = _Gui()
Global $ahButtons = _Buttons()

GUISetState()

While 3
    _MsgHandler(GUIGetMsg())
WEnd

Func _MsgHandler($msg)
    Switch $msg
        Case -3
            Exit
        Case $ahButtons[0]
            MsgBox(0, 0, "B1")
        Case $ahButtons[1]
            MsgBox(0, 0, "B2")
    EndSwitch
EndFunc

Func _Gui()
    Return GUICreate("GUI", 200, 200)
EndFunc   ;==>_Gui

Func _Buttons()
    Local $aB[2] = [GUICtrlCreateButton("B1", 10, 10), GUICtrlCreateButton("B2", 40, 10)]
    Return $aB
EndFunc   ;==>_Buttons
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Your definitions are incorrect in regards to AutoIt.

 

 

 

The difference between local and global..

Local: means that it will only be in the scope of the script, if declared outside of a function, or if declared in a function can only be used in that function.

Global: Once declared can be used anywhere that is linked to that particular script that it has been declared by. If declared again in another script or function, the original will be overwritten.

Local when declared in a function, and not using the Static keyword: the variable can only be seen by the script as long as it is running inside that function. After that function ends or is "Return"ed from, that variable no longer exists and can't be accessed.

Local  when declared outside of a function, and Global: Can be seen everywhere in the script, inside functions and out. It exists as long as the script runs. Variable names are not shared between running scripts.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Local when declared in a function, and not using the Static keyword: the variable can only be seen by the script as long as it is running inside that function. After that function ends or is "Return"ed from, that variable no longer exists and can't be accessed.

 

 

You can still change,Access, read, a local variable in a function from another function this way:

Example()

Func Example()
    Local $var = 1
    ConsoleWrite($var&@CRLF) ; This will print $var as 1 (The variable has not changed)
    ChangeVar($var)
    ConsoleWrite($var&@CRLF) ; This will print $var as 2 (The variable was changed in ChangeVar())
EndFunc


Func ChangeVar(ByRef $lVar)
    $lVar = 2
EndFunc

I guess that this knowledge will be useful for you.

Unfortunately I learned this only recently

Edited by Guest
Link to comment
Share on other sites

Your definitions are incorrect in regards to AutoIt.

 

 

Local when declared in a function, and not using the Static keyword: the variable can only be seen by the script as long as it is running inside that function. After that function ends or is "Return"ed from, that variable no longer exists and can't be accessed.

Local  when declared outside of a function, and Global: Can be seen everywhere in the script, inside functions and out. It exists as long as the script runs. Variable names are not shared between running scripts.

 

You can still change,Access, read, a local variable in a function from another function this way:

Example()

Func Example()
    Local $var = 1
    ConsoleWrite($var&@CRLF) ; This will print $var as 1 (The variable has not changed)
    ChangeVar($var)
    ConsoleWrite($var&@CRLF) ; This will print $var as 2 (The variable was changed in ChangeVar())
EndFunc


Func ChangeVar(ByRef $lVar)
    $lVar = 2
EndFunc

I guess that this knowledge will be useful for you.

Unfortunately I learned this only recently

 

Thank you both for correcting this for me, seems I needed it. ^_^

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Moderators

MikahS,

The Variables - using Global, Local and ByRef tutorial in the Wiki might be worth a look. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

The Variables - using Global, Local and ByRef tutorial in the Wiki might be worth a look. ;)

 

Just FYI that is a deleted page.

EDIT: This is the page you mean :)

Thank you by the way, M23.

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Moderators

MikahS,

Oops! I have amended the link in my autoposting utility. :blush:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

MikahS,

Oops! I have amended the link in my autoposting utility. :blush:

M23

 

Glad to help, and thanks for yours. ^_^

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

That whole Local in "Global" scope is a bug in my humble opinion, as functions should not be able to see it, due to it be local only to that scope. Then again I don't know why Var isn't used, because we tend not to declare Global variables inside functions (bad practice), thus it would force people to declare Global variables outside of functions, which is the only reason I can see for having Local and Global, to differentiate between when a variable in a function is actually Global and not the default Local.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Usually people create Global varibales to access them from other functions.

What I suggested in #11 is a way to achieve the goal without creating global variable.

So you're saving memory by reducing global variables and still achieve the goal.

Of course, this is not always correct to use this method. But I think that in many cases this is the correct way

Link to comment
Share on other sites

What I suggested in #11 is a way to achieve the goal without creating global variable.

Yes, what you suggested is one approach, though I can think of a couple of more ways as well. Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

That whole Local in "Global" scope is a bug in my humble opinion, as functions should not be able to see it, due to it be local only to that scope.

 

Surely this is similar to a hierarchical system with limited access to locals which are not elevated to global status. The design is by choice and doesn't seem to qualify as a bug in that sense. Saying 'local to the global scope' only makes sense if these variables share the same scope as all other variables declared globally regardless of syntax. ...My thoughts.

Edited by czardas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...