Wednesday, April 22, 2015

reusing Ifs anywere without typing it over and over

I've got this bit of script below, how do I reuse the same piece of code without typing it over and over again.

PS: If it doesn't work, can i know How to use another way to get the same results.

Thank you.

if(List.About.Contains(PlayerInfo.PlayerReply.ToLower()))
{
        Procedures.AboutBox();
        goto LevelSelectionScreen;
}
else if(List.Back.Contains(PlayerInfo.PlayerReply.ToLower()))
{
        goto MainMenu;
}
else if(List.Quit.Contains(PlayerInfo.PlayerReply.ToLower()))
{
        Procedures.Quit();
        goto LevelSelectionScreen;
}

No comments:

Post a Comment