How do I write this if statement with conditional operator?
int TopicID = ...
int LastPost = ...
if (LastPost == 0)
{
LastPost = TopicID
} else
{
LastPost = LastPost;
}
I tried this:
LastPost == 0 ? LastPost == TopicID : LastPost == LastPost;
But it didn’t work so as you can see im not really that pro.. 😛
Anyway, what is the sense of assigning
LastPostto itself? Just remove your wholeelseblock and you’ll have the simplest way for what you’re trying to achieve.