Else If Statements

Why does fail

using System;

namespace ElseIfStatement
  class Program
    static void Main(string[] args)
      int guests = 3;

		if(guests == 6){
    }else if(guests == 3){


Which step fails? You need to set the amount of guests depending on the step you are on (for step 1, set guests to 6)


Hello @ps3.
I just ran your code. It seems the SCT for the lesson is expecting you to use an else if to check for 0 guests instead of simply an else statement.


And the directions say to use a if not a else if
So that needs to be fixed in the system correct?

The directions just say:

Lastly, if no one shows up, have the program print Solitaire to the console.

However, the hint says:

When writing an else statement, make sure it comes after your if and else if statements:

So, you are correct that the lesson should be ‘fixed’. The way you did it originally is how I would have done it as well with an else statement. I don’t know why the SCT expects an else if, but it does. Feel free to click on the Get Help icon, and submit a Bug Report. The directions clearly don’t match what is expected.


I think you’re correct @midlindner, but thinking about it, that’s the only way it makes sense. Solitaire can only ever be played with one person and the else statement would be applicable to groups of 2,4,5+. But I definitely think the hint is kinda misleading.


Yeah. The whole premise that you’re having guests over to play a game, and you’ll have 6 guests, 3 guests or no guests is kinda odd. Would be more ‘real world’ if they were ranges like 4-6, 1-3, or 0. Oh well. In the grand scheme of things it’s not that big a deal. The purpose of the lesson was to teach the use of else if. I suppose it more or less does.