Question about ?: (if/else) operators

I learned to use these operators only a few days ago so I’m still trying to figure out how to them exactly. Here’s a problem I have though:

When I use it like this it works:

intName = condition
?  1 
:  2

But when I try this it doesn’t work

? intName 1 
: intName 2

While it doesn’t matter in this situation cause I can just use the first one, it does matter in other situations. I’m currently trying to do this:

GameObject == null ? StartCoroutine(Name()) : doSomething();

The error I’m getting is the following :

Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement.

Seen this error a lot but in this certain situation I don’t know how to fix it. Thanks in advance :), also if anyone wants to tell me how to show my code better instead of typing it out here feel free too cause I’m kinda new to asking questions so I have no idea how everyone does that.

?: is not the very same as if/else, it is a conditional operator (?: operator - the ternary conditional operator | Microsoft Learn). You can use it to assign the conditional values to some variable, but not as a if/else replacement when you do not have an assignment.

That way to use if/else is called “ternary operator”. It’s made to be used in expressions that have to return some value.
In other words, whenever you use a ternary operator you are telling to the program that you are going to return something from that expression.
So, for example, the line true == true ? 1 : 2 is going to return 1 when executed. C# doesn’t allow expresions that returns something if you’r not assigning the returned value to any variable. if you do this int myVal = true == true ? 1 : 2 the expression will be executed correctly and myVal will have a value of 1.
That’s the difference between the regular if/else declaration and the ternary operator.