【C#】return文【忘れるので】

class A{

    public int add (int a, int b){   //戻り値の型:int型、メソッド名:add

        int x;

        x=a+b;

        return x;                //xが戻り値

    }

}

 

reruen文

メソッドを終了し、戻り値を返す役割を持つ。