webbiz
Member
- Joined
- Oct 15, 2011
- Messages
- 21
- Programming Experience
- 10+
(VS 2010)
I'm getting an error "Use of unassigned local variable 'fJDCCorrection' for the following code line:
fJDMoonPhase = fJDMoonPhase + fJDCorrection + E;
I don't understand why the error except that assignment to this variable requires making it through one of the CASE statements in my Switch.
Is it a requirement in VS C# that I assign this variable with some value initial value?
Is this VS C# way of preventing the possibility that none of the CASE statements prove true?
I'm thinking this may be the case but thought to ask as I'm really new at this.
Thanks.
I'm getting an error "Use of unassigned local variable 'fJDCCorrection' for the following code line:
fJDMoonPhase = fJDMoonPhase + fJDCorrection + E;
I don't understand why the error except that assignment to this variable requires making it through one of the CASE statements in my Switch.
switch (iPhase) { case 0: case 2: fJDCorrection = pfunPTC_NewFull(T, fMoonsArgLat, fSunsMeaAno, fMoonsMeaAno); break; case 1: fJDCorrection = pfunPTC_1stQtr(T, fMoonsArgLat, fSunsMeaAno, fMoonsMeaAno); break; case 3: fJDCorrection = pfunPTC_LastQtr(T, fMoonsArgLat, fSunsMeaAno, fMoonsMeaAno); break; } fJDMoonPhase = fJDMoonPhase + fJDCorrection + E;
Is it a requirement in VS C# that I assign this variable with some value initial value?
Is this VS C# way of preventing the possibility that none of the CASE statements prove true?
I'm thinking this may be the case but thought to ask as I'm really new at this.
Thanks.
Last edited by a moderator: