Bug? Unused Variable 'z'. (warning #9)

Gary Miyakawa

Active Member
Licensed User
Longtime User
I'm seeing a couple warnings about unused variables in the IDE when they are clearly dim'd. If I comment them out, I get errors on every reference so the DIM is working but the message sees to be off...

The program works fine... just seems like the message isn't correct...

Gary M
 

Attachments

  • B4J_Vars.JPG
    B4J_Vars.JPG
    25.5 KB · Views: 265
  • B4J_Warning.JPG
    B4J_Warning.JPG
    16.2 KB · Views: 240

stevel05

Expert
Licensed User
Longtime User
Do you actually read the value of the variable or access it (apart from assigning a value to it) anywhere?
 

Gary Miyakawa

Active Member
Licensed User
Longtime User
Do you actually read the value of the variable or access it (apart from assigning a value to it) anywhere?

Actually, no, not yet... haven't added that code....

Just looked at it (after reading your message) and yes, as soon as I reference it (if statement or ...) the warning clears.

Thank you !

Gary Miyakawa
 

Cableguy

Expert
Licensed User
Longtime User
This is a very common question...
We tend to misread the warning... when it clearly states "the variable is not used"...
And it means just that, that we have declared a variable but it remains unassigned any value. This is helpful, because sometimes we declare variables to be used as flags somewhere in the code, but later we end up not using them due to code changes...
Declaring a variable allocates memory to it, so having empty variables is a waste of precious resources.
 
Top