End Google Ads 201810 - BS.net 01 -->
I need to increase the scope of double fee and total. The following code doesn't work because fee and total are out of the scope on the writeline.
if (time <= 3)
{
fee = 2;
total = total + fee;
}
I have more if statements involving fee and total but they all will be applied to the following writeline
Console.WriteLine("Current charge: {0:c}, Total receipts: {1:c}", fee, total);
Edit:
I made fee and total a static variable above the main method and now it works even though I set the new value of fee and total inside a block with less scope. I am not sure how this works, but it works, maybe someone can tell me why it works.
modified on Saturday, July 11, 2009 7:11 PM
مواقع النشر (المفضلة)