ok so i've seen [? and :] used in as replacement for some if statements in a lot of code
for example
driftDirec = Input.GetAxis("Horizontal")>0 ? 1: -1;
why not something like
if (driftDirec > 0)
{ do stuff}
else
{do stuff}
or something, can you tell me when is the appropriate time to use those and i don't know what that's called?
Aucun commentaire:
Enregistrer un commentaire