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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Random word with a in the script NOT producing any error

Discussion in 'Scripting' started by AdamLiu, Mar 20, 2015.

  1. AdamLiu

    AdamLiu

    Joined:
    Mar 19, 2014
    Posts:
    71
    I just found that any word with a colon in a method of a script will not generate any errors. For example:

    Code (CSharp):
    1. void Start()
    2. {
    3.      whateverTextHere:
    4.      //more code
    5.  
    6. }
    I believe I'm a rookie in C#, can anyone tell me why is this script working without any errors? Thanks a lot.
     
  2. Random_Civilian

    Random_Civilian

    Joined:
    Nov 5, 2014
    Posts:
    55
    It's probably the colon sign.
    It marks it as a label for goto