I'm writing GUI controls and there are many places where there are many nested ifs checking for some result.function TMyObject.GetCursor: TCursor;begin  if CanDragX then  begin    if CanDragY then      Result := crSizeAll    else      Result := crSizeWE;  end  else if CanDragY then    Result := crSizeNS  else  if CanClick then    Result := crHandPoint  else    Result := crArrow;end;How would you format/rewrite this code?
Nested IF code in GUI Controls
delphi
I would do this:function TMyObject.GetCursor: TCursor;begin  if CanDragX and CanDragY then    Result := crSizeAll  else if CanDragX then    Result := crSizeWE  else if CanDragY then    Result := crSizeNS  else    if CanClick then      Result := crHandPoint    else      Result := crArrow;end;But really it is a matter of style and what is most readable to you (and the person who will maintain it).