How to fix "Use Of Unassigned local variable in citra" when citra is defined? (with Object Oreinted Programming, bools, and switch statements) : <p>Recently I was attempting to make an advanced choose your own adventure game to practice my fresh new C# skills but I have came across a powerful error that is preventing me from continuing my project."Use Of Unassigned local variable in citra" on line 58 inside the story_Confirmation method is an error I came across that is not allowing me to return citra for some odd reason. Can I please get some assistance?</p>

<p>Code is below:</p>

<pre><code>using System;

namespace FirstConsoleProgram
{
    public class Game{} //Currently Nothing

    public class Story : Game
    {
        public int stro;
    private string intro;

    public Story(int _stro)
    {
        stro = _stro;
        if(stro == 1)
        {
            SetIntroTXT("how you \"The Avatar\" have to save the world from pain and destruction. \n You travel the world gaining new spells and abilities until the ultimate battle \n where you have to fight Lord Ozai");
            bool reply = story_Confirmation(5);
        Console.WriteLine(reply);
        }
    }
    void FirstStory()
        {
            ; //Currently Nothing
        }
    void SetIntroTXT(string txt)
    {
        intro = txt;
    }

    bool story_Confirmation(int cont)
    {
        Console.Clear();
        Console.WriteLine(intro);
        Console.WriteLine();
        bool citra;
        Console.WriteLine("Are you sure you want to confirm? (y/n)");
        string awn = Console.ReadLine().ToUpper();
        if(awn == "YES" || awn == "Y")
        {
            cont = 1;
        }
        else if(awn == "NO" || awn == "N")
        {
            cont =  2;
        }
        switch(cont)
        {
            case 1:
            citra = true;
            break;
        case 2:
            citra = false;
            break;
        }
        return citra;
        }
    }
    public class Program
    {
        public static void Main(string[] args)
            {
             Console.WriteLine("Welcome to Choose your adventure!");
             Console.WriteLine();
             Console.WriteLine("Out of the 5 Stories, which one would you like to play?");
             string stro_sel = Console.ReadLine();
             Story GameStory = new Story(1);
        }
    }
}
</code></pre>

<p>Any help apreciated! Thanks!</p>

<p>Warning: Please mind my English grammar and note that I had to copy and paste the code and make it look neat(because the whitespace was terrible when I pasted it in). That could explain why it might look sloppy without whitespace.</p>

<p>Another sidenote is that this is not a duplicate because the other questions on this topic did not awnser my question nor did it help me solve my programming problem. My problem takes a statement into object oreinted programming(with classes and methods) and uses switch statements. The previous questions on this topic has unique problems that I did not face, and by asking this I am trying to resolve my issue, not a general issue on the error, but what I did wrong in my code.</p>

<p>In best regards, thanks.</p>
