The if Decision Statement - Day 1 - Part 11

Download this episode

Download Video


The “if” statement allows us to add logic to our code, execute one code block if a certain condition exists, or execute a different code block if a certain condition doesn't exist. This video examines simple usage as well as more complex “if” statements.

Download the source code in c#

Download the source code in VB.Net



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      Nice tutorial, thank you!

    • User profile image

      Good tutorials. Remind me though never to go on your gameshow haha

    • User profile image

      I'm Android App engineer.
      Good tutorials. thank you^^.
      I think Windows Phone Application (silverLight) is more easier then Android Application.
      And IDE tools also more powerful ( eclipse is very slow......)
      I'm Korean. So I don't have real Windows Phone.
      In Korea, WP will sold next year ㅠㅠ..

    • User profile image

      That's great! I'm learning a lot. I'm Mexican and I try to make videogames for WP7. This tutorial es good for learning,

    • User profile image
      Eddy Frometa

      This are really good tutorials. I used to code with Visual Basic 6. I was good with the syntax in vb6. These are my first lessons with C# and it's very easy to learn. Thanks for sharing your knowledge ...

    • User profile image

      Excellent tutorials.
      The "If" tutorial does not explain why I can't just use multiple "if" statements instead of the "else if" option. I wrote the example using multiple "if" instead of "else if" and it still works.

    • User profile image

      @Awake: If you do not include the else, then each of the if statements will be evaluated.

      If you do include the else, then if one of the if statements evaluates to true then the following else if statements do not need to be evaluated and the code will continue running after the block of else if statements (meaning less processing needs to occur).

      Hope that makes sense.

    • User profile image

      Hi, i´ve been having this problem, when i want to 'double-click' a tool (like textBox, Button, etc) sometimes it takes me to the xml.cs so i can write the code, and sometimes nothing happens so i can continue. Why is that?

    • User profile image
      Yaya Jallow

      thanks microsoft for these wonderful videos, i'm release my first phone app onto Windows Phone 7 just becuase this

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.