so, I keep getting an use of unassigned local variable 'table' error when debugging my code. I'm trying to make an multiplication table.
Here is the look of my code;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Multiplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnDisplayTable_Click(object sender, EventArgs e)
{
int table;
int result;
for (int i = 1; i < 13; i++) {
result = table * i;
lstTable.Items.Add(result);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void LstTable_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void txtTable_TextChanged(object sender, EventArgs e)
{
}
}
}
Any help and explanation would be appreciated.