1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Alternatives to if-statement

Discussion in 'C#' started by aloha91, Sep 29, 2010.

  1. aloha91

    aloha91 New Member

    Sep 29, 2010
    Likes Received:
    Trophy Points:
    I have been working on a project, where I am able to choose the different positions of the body parts of a robot to form a dance step. The head with 3 movements. The left and right arm, shoulder and elbow with 4, 4 and 3 movements respectively. The waist with 5 movements and the direction with 5 movements too.

    Now, I'm facing a problem, I want to be able to see the preview of the robot, which involves using images and LOTS of if-statements. However, that will involve alot of if-statements to write, which will be VERY time consuming and messy. I tried using a switch statement but I realized using a switch statement doesn't work for a string.

    I would like to ask if there is any available conditional statements or any available alternatives I can use so as to decrease the codes I need to write. The values used to compare will be strings FYI. I am using .NET Framework 4 and Microsoft Visual Studio 2008, Windows 7 if the information is necessary.

    Thanks alot of helping and pardon my english :S

Share This Page