Comments (3)
Labels are scope-dependant in QuickBASIC. The code above will yield a "Label not defined" error in Function Foo(x). If you had another Yikes label in FUNCTION Foo(x) that would be valid too - no duplicate if different scope.
Only case of cross-procedure GOTO is with ON ERROR GOTO, which always requires a label in the main module (unless you consider ON LOCAL ERROR GOTO, which is about another type of BASIC, not historical ones).
from wwwbasic.
Thanks Fellippe.
Labels per function sounds sane.
Do you know offhand how names work in terms of different types of objects?
Are variables, subroutines, functions, and labels all in one namespace, or is there some separation?
(Things easily answered for one version, but figure QB64 folks have a better sense of over multiple versions etc.?)
from wwwbasic.
I couldn't answer about multiple versions. We QB64 folks are all about QBasic/QuickBASIC 4.5 only.
The answer here is: same namespace.
The exception is for SHARED variables. You can have a variable DIM SHARED in the main module, which makes it accessible in sub/functions, but then you can override it and have a local variable of the same name/type that is local to a procedure.
DIM SHARED a AS LONG
a = 1
mySub
SUB mySub
DIM a AS LONG
PRINT a
END SUB
That prints 0, not 1, as a is now local to mySub.
from wwwbasic.
Related Issues (20)
- Support for BASIC dialects HOT 4
- Implement ON x GOTO a,b,c,d HOT 5
- Add a copyright header check. HOT 1
- Some issues found by static analyzer HOT 3
- Implement error on out of bounds array access.
- Implement PLAY and SOUND HOT 7
- ON GOSUB may be slightly off. HOT 3
- Handle touch screen input better.
- Some Guidance on The Why? HOT 3
- Support GORILLAS.BAS HOT 2
- Emulate EGA/VGA PALETTE + CGA Background HOT 1
- Support the ANY type properly HOT 1
- Support EGA/VGA Text 8x14 / 9x16
- Set the input focus in the browser HOT 1
- Add waffle.io project management
- Changing tabs flips wwwBasic window upside down HOT 1
- Basic Anywhere Machine
- A suggested bug-fix for the "swap" statement HOT 1
- BASIC Anywhere Machine: enhancements to internal copy of wwwBASIC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wwwbasic.