Note that there are some explanatory texts on larger screens.

plurals
  1. POI don't understand why I am receiving the following errors
    primarykey
    data
    text
    <p>I am pretty sure that I have all this right. I am thinking that somehow my syntax is wrong, but I am having no luck trying to Google as to why it is wrong. Here is my code:</p> <pre><code>namespace Exercise1 { class Program { static void Main(string[] args) { Values aValue = new Values(); //set array int[] number = new int[12]; //ask user for input Console.WriteLine("Please enter a value between 0 and 10: "); aValue.InValue = Console.ReadLine(); //Read input aValue.IntValue = int.Parse(aValue.InValue); //convert string to int while (aValue.IntValue != -99) //user has not stopped program if (aValue.IntValue &gt; 10 || aValue.IntValue &lt; 0) //valid value Console.WriteLine("Thank you! Please enter '-99' when you are ready to finsih."); aValue.InValue = Console.ReadLine(); //read input aValue.IntValue = int.Parse(aValue.InValue); //convert string to int number[aValue.IntValue]++; //add input to corresponding array box ???? else Console.WriteLine("You have entered an invalid value."); aValue.InvalidValueCount()++; namespace Exercise1 { class Values { private string inValue; public string InValue { get; set; } private int intValue; public int IntValue { get; set; } private int validValueCount; public int ValidValueCount { get; set; } private int invalidValueCount; public int InvalidValueCount() { invalidValueCount = 0; return invalidValueCount; } } } </code></pre> <p>Error messages are as follows: </p> <blockquote> <p>Invalid expression term 'else'<br> ; expected (after "else")<br> Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement (after "<code>number[aValue.IntValue]++;</code>")<br> The operand of an increment or decrement operator must be a variable, property or indexer (after "<code>aValue.InvalidValueCount()++;</code>")</p> </blockquote> <p>Thanks for your help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload