CS8025 C# Feature 'local functions' is not available in C# 4. Please use language version 7 or greater.

This My Code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Sprites;
using System;

public class Card : MonoBehaviour
{

public static bool flipped = false;
[SerializeField]
private int state;
[SerializeField]
private int cardValue;
[SerializeField]
private bool initialized = false;

private Sprite cardBack;
private Sprite cardFace;

private GameObject manager;

public void Start()
{
    state = 0;
    manager = GameObject.FindGameObjectWithTag("Manager");
}
public void SetupGraphics()
{
    cardBack = manager.GetComponent<GameController>().GetCardBack();
    cardFace = manager.GetComponent<GameController>().GetCardFace(cardValue);

    FlipCard();
}
void FlipCard()
{
    if (state == 0 && !flipped)
    {
        GetComponent<Image>().sprite = cardBack;
    }
    else if (state == 1 && !flipped)
    {
        GetComponent<Image>().sprite = cardFace;
    }
}
public int CardValue
{
    get { return cardValue; }
    set { cardValue = value; }
}

public int State
{
    get { return state; }
    set { state = value; }
}

public bool Initialized
{
    get { return initialized; }
    set { initialized = value; }
}

public void FalseCheck()
{
    StartCoroutine(pause());

      IEnumerator pause()
    {

        yield return new WaitForSeconds(1);
        if (state == 0)
        {
            GetComponent<Image>().sprite = cardBack;
        }
        else if (state == 1)
        {
            GetComponent<Image>().sprite = cardFace;
        }
        flipped = false;

    }
}

}
,

Like we said in the comments above you declared your coroutine inside another method. This is not possible (at least not in the version of Mono / C# that Unity uses). You have to declare your coroutine outside of the “FalseCheck” method but still inside the class scope of your “Card” class.

Generally there are different kind of scopes / declaration spaces and each can only contain specific language elements.

Scopes of a C# file:

File scope

A single C# file does not really define it’s own scope. All files are actually compiled together into one assembly. A C# file can only contain the following things:

  • using directives (have to be at the top of the file)
  • namespaces
  • type definitions (class, struct, interface, enum, delegate)

Namespace

A namespace is just an organisation declaration space / scope. It’s not a real “thing” but rather acts like a “folder” for type definitions. If you declare a type directly inside a C# file you actually defined that class in the global namespace which essentially is the top most / root namespace that encloses everything, A namespace can contain the exact same things as a C# file. So you can defined types inside a namespace or even define a sub namespace inside that namespace. A common example in Unity is the UI namespace which is a subnamespace of the UnityEngine namespace.

To access a class from a different namespace you either have to use the full qualified classname (the classname and the complete namespace “path” to that class as prefix) or add a using statement at the top. For example the full class name of Unity’s Button class from the uGUI system is UnityEngine.UI.Button

Type definitions

class

The class type is the most important type in object oriented programming. It describes / defines the content (data / variables) and methods of an object instance. The class scope (which could be seperated into several sub categories like instance or static and private, protected, public but for now it's considered just one) can contain the following declarations:
  • variables
  • properties (special kind of get and set methods)
  • methods
  • other type declarations

Hopefully the connection between a class and it’s variables / properties / methods is clear. A class can act like a “pseudo” namespace since a class can define other types as nested types. Note that this is just the hierarchical place where that type is defined. Just because a type is a nested type of a class doesn’t necessarily mean that the type types (the outer class and the nested type) are connected in any way. If the nested type is declared public it can be used from everywhere else and has no connection to the enclosing type. Though it would be a horrible design to nest a type inside another if they don’t belong to each other in some way. If in doubt, don’t nest classes.

struct

The struct actually is almost the same as a class. It can contain the same type of child elements, but it's actually a value type and not a reference type. This is a whole topic on its own and doesn't have any influence on this topic here about scope and declaration spaces.

interface

An interface type is a special type which is similar to a class but heavily restricted. An interface can only be derived from another interface. An interface can only define method signatures that a class or struct has to define if that class or struct implements this interface. It’s just a “method contract” which allows an abstraction of different objects and provide a common interface. An interface can only contain:

  • method signatures (no method body)
  • property signatures (no property method body)

So interfaces do not contain any executable code and do not contain any data, just method signatures.

delegate

Technically a delegate is just a special kind of class that is treated in a special way by the language runtime and the compiler. It represents the concept of a "method pointer". In a nutshell a delegate type is just a single method signature which got it's own type name. A delegate declaration doesn't have any body and therefore can't contain any child / sub elements.

When you create a variable of a delegate type, this variable can contain a “reference” to any method that has that signature that the delegate type expects.

enum

An enum type definition is essentially just an alias type name for an integral primitive type (byte / sbyte, short / ushort, int / uint or long / ulong). It is treated as a seperate type by the compiler but allows casting into it’s underlying type and vice versa. An enum declaration has a body which can contain constants. Those constants are the actual “things” which are “enumerated”. Those constants are actual concrete values of this enum type. An enum body can not contain any other elements beside those constants.

Method

A method declaration inside a class or struct generally consists of two things:
  • The method header / signature
  • followed by the method body

The only special cases are abstract methods which do not have a method body (like interfaces) as well as the get and set methods of a property which do not have a full method signature. In so called auto-properties the get and set method do not have a method body either as this is generated by the compiler (syntactic sugar).

Method header / signature

The method header consists of the method signature as well as some class related access modifier (public, private, protected, internal, ...). The signature of a method defines the name of a method and its parameter types. Usually the return type of a method is not considered to be part of the signature, though in many cases the return type also needs to match up.

Method body

The method body contains actual code statements that can be executed. Statements are things like calls to other methods, assignment, increment / decrement operations as well as the declaration of local variables. Note that inside a method you can’t define new types or additional methods with the exception of anonymous methods and lambda expressions which is again just syntactical sugar and actually creates a hidden class that will contain that method.


Final notes

Generally each pair of curly braces { } define a seperate scope. A nested scope generally knows everything that is defined in the outer scopes. However this is not true the other way round. The outer scope does not have general access to things defined in a nested scope.