Can someone tell me what I'm doing wrong? The debugger says that "answer" does not exist in the current context.
using System; public class Program { public static void Main() { Console.WriteLine("Enter a number: "); int num01 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter another number: "); int num02 = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Do you want to add or multiply them? (Type 'A' for addition and 'M' for multiplication)"); string userInput = Console.ReadLine().ToUpper(); if (userInput == "A" ) { int answer = num01 + num02; } else { elsehappens(num01, num02); } Console.WriteLine(answer); // It shows the error in this line. } public static int elsehappens(int num01, int num02) { int answer = num01 * num02; return answer; } }