I saw this kind of logic somewhere in an apex code and got curious about how this can be done. The code is a one liner and does variable check and assignment in the same line. It uses the <> operator to check , for example:
String s = if(s<>null,'Hello',null);
The above code is not accurate and gives compiler error. I am unable to remember what was the correct syntax for doing such an assignment and check at the same line. Any idea? THis one liner saves the number of lines to write a if check and then assign value logic.