| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>Local variable</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- variable = any valid variable name
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- This command is probably just here for compatibility with other BASIC languages. LOCAL will let you specify that the variable you are defining is available ONLY to the program or Function you are assigning it in. In order to get a variable to be accessible anywhere in your program, you need to make it GLOBAL. I say it is only here for compatibility because whenever you assign a variable that isn't Global, it is automatically assigned as a LOCAL variable. You can optionally assign a value to the variable at the time of declaration. See example.
- <br>
- <br>
- See also: <a class=small href=Global.htm>Global</a>, <a class=small href=Const.htm>Const</a>, <a class=small href=Dim.htm>Dim</a>.
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/Local.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; Local example
<br />
-
<br />
- ; set lives to 5 for the main program loop
<br />
- Local lives=5
<br />
-
<br />
- ; Call a function
<br />
- while not keyhit(1)
<br />
- showlives()
<br />
- Wend
<br />
-
<br />
- Function showlives()
<br />
- ; For this function, lives will be 10!
<br />
- Local lives=10
<br />
- Print lives
<br />
- End Function
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Local&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|