Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string variable ending up with null #2393

Open
niden opened this issue Sep 27, 2022 · 0 comments
Open

string variable ending up with null #2393

niden opened this issue Sep 27, 2022 · 0 comments
Assignees
Labels

Comments

@niden
Copy link
Contributor

niden commented Sep 27, 2022

    protected final function getSpecial(int special) -> string
    {
        string suffix = "";

        switch special {
            case 1:
                let suffix = "alpha";
                break;
            case 2:
                let suffix = "beta";
                break;
            case 3:
                let suffix = "RC";
                break;
        }

        return suffix;
    }

The above returns null when special is other than 1, 2 or 3. If a default clause is added to the switch it makes no difference.

Also adding

let suffix = "";

has no effect.

If the variable is changed to var suffix then the code works (i.e. you get an empty string if special is 4)

@niden niden added the bug label Sep 27, 2022
@Jeckerson Jeckerson self-assigned this Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants