Please give some advice about ScreenOrientation

Hello everyone.

I don’t have much of experience in working with Android and iOS devices.

So I’am asking for advice

If I want in some statement left Screen oriented only Portrait should it be like this?

    void Update () {
        if ("this true")
        {
            Screen.autorotateToPortrait = true;
            Screen.autorotateToLandscapeLeft = false;
            Screen.autorotateToLandscapeRight = false;
            Screen.autorotateToPortraitUpsideDown = false;
            Screen.orientation = ScreenOrientation.Portrait;
        }
        else if ("another condition when I want it to be left oriented and portrait")
        {
            Screen.autorotateToPortrait = true;
            Screen.autorotateToLandscapeLeft = true;
            Screen.autorotateToLandscapeRight = false;
            Screen.autorotateToPortraitUpsideDown = false;
            Screen.orientation = ScreenOrientation.AutoRotation;
        }
    }

Will this work?
Sorry if this is simple question but testing it via compilation is longer then ask some one.
Thanks.

Yeap it will work.