mercredi 25 février 2015

If Statement Contains Only "True"

I am converting a vb6 app into c# and I've come across something I don't quite understand. I've never seen an if statement structure where the expression being evaluated is literally "true" or "false".



private bool InitializeForProgramming() //OK
{
if (J1939.getReplyStatus() == modJ1939.dmOpFailed) //or OpComplete (dmBusy auto cycles)
{
//check the Pointer value to see if engineRunning, or already in Mode
if (true) //let it proceed *** ??
{
//nothing to do
}
else
{
lblCommun.Text = "ProgramMode Failed!";
lblCommun.ForeColor = Color.Red;

//could report more detailed reasons! (engineRunning, etc.)
return true; //FAILED!
}

}


What is being evaluated here with the expression if(true)? If what is true?


Here is the original vb6 code:



Private Function InitializeForProgramming() As Boolean 'OK
If getReplyStatus = dmOpFailed Then 'or OpComplete (dmBusy auto cycles)
'check the Pointer value to see if engineRunning, or already in Mode
If (True) Then 'let it proceed *** ??
'nothing to do
Else
txtCommun.Text = "ProgramMode Failed!"
txtCommun.ForeColor = vbRed

'could report more detailed reasons! (engineRunning, etc.)
InitializeForProgramming = True 'FAILED!
Exit Function
End If
End If


Please let me know if you need me to include anything else to help me get an answer.


Aucun commentaire:

Enregistrer un commentaire