DIM in an if..then statement error


[code]if field1 or field2 is > 0 then
DIM a as double = field1 + field2
DIM a as double = field3 + field4
end if

dim c as double = 100+a[/code]

the above fails at “dim c” because “a” does not exist. What I’m trying to do is DIM a variable but if the first set of variables = 0, then dim variable based on these other 2 values.

EDIT: Nevermind… Found my answer here:

Excellent! Yes, you always need to keep an eye at the scope of properties. If in doubt DIM before a clause and set the value in it.
This is true for methods in general and class inheritance too where you could have a “super” property and a local one in a method with the same name but not being the same.