You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
You can, but it's not a good idea as it becomes hard to differentiate in certain parts of your code if you omit the parentheses in some statements, making the code harder to maintain. For example:
Code:
#DIM ALL
FUNCTION PBMAIN
LOCAL D$(), D$
DIM D$(1:100)
D$ = "123"
ERASE D$ ' this means the array, but is not clear!
ERASE D$() ' this is clearer, but not compulsory
...
END FUNCTION
Personally, I try to aviod single letter variable names, except I do use them for "scratch", temporary and loop counter variables. Otherwise I try to use descriptive names - there is no run-time penalty whatsoever on using very long variable names (there is just more typing!).
Thanks.
This is a 'cleaning-operation' and I just wanted to make sure.
Obvously there are a difference between declared and not declared variables.
Undeclared variables can have same name, ie
MyVariable&,MyVariable$
but declaring them is not allowed: ie
Local MyVariable&,MyVariable$
Yes, two *scalar* variables cannot share a common "base" name if you are using #DIM ALL or OPTION EXPLICIT, as the compiler will complain about the duplicate definition.
However, your initial question was about a common base name bewteen a scalar and an array which is allowed.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment