Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question Question mark and colon in float declaration c#

Discussion in 'Editor & General Support' started by etekmen13, Mar 28, 2023.

  1. etekmen13

    etekmen13

    Joined:
    Dec 2, 2017
    Posts:
    2
    What does the following code mean?
    I've seen that question mark indicates nullable type, but I don't think thats the case here.

    float f = UnityEngine.Random.value > 0.5f ? -1f : 1f;
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    4,501