Bug? B4A IDE Variable Error

By-Cod3rs

Member
Licensed User
I create a variable in B4A and assign a value to it.
I delete this variable from the compiler, but the assigned value remains.
The compiler gives this in warnings, but compiles and loads.
But if the variable is inside the if block, it does not allow it to be loaded.
can you watch the video ?
what is the reason of this?
 

eps

Expert
Licensed User
Longtime User
I'm not actually sure what you're trying to prove with this code.... The compiler gives you a warning - you should review it and resolve
 

By-Cod3rs

Member
Licensed User
I'm not actually sure what you're trying to prove with this code.... The compiler gives you a warning - you should review it and resolve


Don't comment if you don't understand. No compiler does not compile for a variable that is not.

see:Visual studio
see:CSS C
see:Atmel Studio
see:Ardunio
see:Eclipse
see:STM32 CubeMx

I use it in all these compile projects.
The problem is, do you want B4x to improve or not?
 

agraham

Expert
Licensed User
Longtime User
You should always resolve compiler warnings or strange things might happen. You can hardly miss the warning can you? In this case your 'missing' variable is being automatically dimmed as a string variable as you can see
B4X:
undimmed= True
Log(GetType(undimmed))
By the way, a little more civility to other posters would be welcomed when they try to assist.
 

By-Cod3rs

Member
Licensed User
You should always resolve compiler warnings or strange things might happen. You can hardly miss the warning can you? In this case your 'missing' variable is being automatically dimmed as a string variable as you can see
B4X:
undimmed= True
Log(GetType(undimmed))
By the way, a little more civility to other posters would be welcomed when they try to assist.

I indicate when information about dear agraham.ben is given.
and i say:It gives an error on the if blog and prevents compilation. But it doesn't block the variable assignment.
This is an IDE issue.
and my goal is that we can improve B4x just by notification.
It is the erel and her team who will take this into account and decide.
I say it appears in the warnings, you should pay attention to the warnings, it is really amazing
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. I don't recommend you to use SlidingMenu. It was moved to the old libraries archive for a good reason (https://www.b4x.com/android/forum/threads/jfeinstein10-slidingmenu-library.36482/).
This is the only issue here.

2. No reason to post a two and a half video. Just post two small code snippets. It will be quicker for us to read and easier to reproduce.

3. While it is not recommended and doesn't really worth discussing too much, you can use variables without declaring them:
B4X:
x = True 'no error
Log(x) 'no error
If x = True Then 'no error
    
End If
Log(y) 'error

You can never get the value of a variable that wasn't declared and wasn't assigned anything. When you dim a variable it is assigned the default value.
This is the reason for the error on the If line in your code and the Log(y) in my code.
 

By-Cod3rs

Member
Licensed User
1. I don't recommend you to use SlidingMenu. It was moved to the old libraries archive for a good reason (https://www.b4x.com/android/forum/threads/jfeinstein10-slidingmenu-library.36482/).
This is the only issue here.

2. No reason to post a two and a half video. Just post two small code snippets. It will be quicker for us to read and easier to reproduce.

3. While it is not recommended and doesn't really worth discussing too much, you can use variables without declaring them:
B4X:
x = True 'no error
Log(x) 'no error
If x = True Then 'no error
   
End If
Log(y) 'error

You can never get the value of a variable that wasn't declared and wasn't assigned anything. When you dim a variable it is assigned the default value.
This is the reason for the error on the If line in your code and the Log(y) in my code.
dear erel, I want you to follow well.
define a variable, then delete that variable.
The IDE treats this variable as if it exists.
Step by step, what am I doing and what comes out as a result, the video has it all.
 
Top