Quote:
I am getting C# error 1002 in my code.
First reaction, ask Google.
The error code comes with position in source code, when you ask for help, it is a nice idea to give complete information as not every one have the language ready to run with your details.
This loop is absurd:
for(i = 0;i < 1; i++);
The loop is empty and can be replaced by
i = 1;
Advice: Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
using System;
public class Source
{
static public void Main ()
{
int mob;
int character = 15;
Random random = new Random();
int i;
string[] mobs = {"hobgoblin", "goblin", "imp"};
for(i = 0;i < 1; i++);
Console.WriteLine("you are a adveturer");
Console.WriteLine("and you are equiped with a sword and a bow");
Console.WriteLine("you are walking down a path an sudenly you encounter an enemy");
Console.WriteLine("you encountered a");
string enemy = (mobs[(random.Next(0, 3))]);
Console.WriteLine(enemy);
int hitpoints;
{
if (enemy == "hobgoblin")
hitpoints = 15;
else if (enemy == "goblin")
hitpoints = 12;
else if (enemy == "imp")
hitpoints = 14;
}
{
string fight = Console.ReadLine();
if (fight = attack)
hitpoints -- 4;
}
}
}
Indentation style - Wikipedia[
^]
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]
[Update]
By the way, where have you found this syntax:
hitpoints -- 4;