This compiler warning means that, at the line where it occurs, the value of a variable is used that may not have been initialized (ie. nothing in the code above that line specifies what its value should be).
➢This often happens when your code has a branch before, and in one of these branches the variable referred to is undefined.
In the case of an if branch it usually occurs if no value is assigned to the variable in the else branch (or if there is no else branch).
In the example below, if WeekdayOf(Today()) is not equal to 2, then the value of nTemp is undefined.
if WeekdayOf(Today()) == 2
nTemp = 1
// what happens to nTemp here ???
bRESULT = (nTemp == 2) // nTemp may be undefined
This warning can also be caused by a missing else statement in a switch statement.
nTemp = n_TokenDate mod 3
sTemp = 'hryerg'
sTemp = 'fasdfad'
// what happens for all other cases ???
bRESULT = (sTemp == 'h') // sTemp may be undefined
This warning can usually always be addressed by adding code to determine what happens in the else branch of a code branch.
See also: variable is not initialized.
Topic 109011, last updated on 18-Apr-2020