scripting with dropdown menu label

I want to do something like

    if(*selected text in a dropdown menu* = "temperature")
    {
           callfunction()
    }

how do I call text from dropdown menu ? thanks in advance.

If you use a dropdown ui (Create/UI/Dropdown), you can add text for every option.
Then you can add a listener to the OnValueChanged event, that method is meant to take in an integer.

public void method DDValueChangedHandler (int selection)
{
    switch (selection)
    {
        case 1 :
            CallMethod();
            break;
    }
}

For those having trouble with TMP Drop down Menus.

    using TMPro;
    
    public class NewDropMenu : MonoBehaviour
    { 
        public void  DDValueChangedHandler()
        {
            int selection;
            selection = gameObject.GetComponent<TMP_Dropdown>().value;
            switch (selection)
            {
                case 0:
                    Method();
                    break;
                case 1:
                    AnotherMethod();
                    break;
            }
        }
    }