# V3201. Return value is not always used. Consider inspecting the 'foo' method.

The analyzer has detected a possible error: the method return value is not used, although it is used in most other cases.

Look at a synthetic example:

    Audio _currentMusic = null;

    void Foo1(....)
    {
      ....
      _currentMusic = PlayMusic();
    }

    void Foo2()
    {
      if (....)
        _currentMusic = PlayMusic();
    }
    ....
    void Foo10()
    {
      ....
      PlayMusic();      // <=
    }

In this example, the return value of the 'PlayMusic' method is used every time, except for one case. The analyzer issues a warning if the method return value is ignored in no more than 10% of cases, and if there are no signs that the value is not being used deliberately.

In some cases, the return value is not to be used in any way. For example, if a method has side effects (changing properties, fields, writing/reading a file, and so on), the return value can be ignored. To enhance code readability, it is recommended to explicitly indicate it by assigning the result of the method to a discard variable:

    _ = PlayMusic();

In this case, the analyzer will not issue a warning.