using UnityEngine;

using System.Collections;


public class ExParam : MonoBehaviour {


// Use this for initialization

void Start () {

int a1 = 10;

int b1 = 20;

int avg1 = 40;

int total = 0;

total = GetTotal(a1, b1, out avg1);

print ("total = " + total + ", avg = " + avg1);

}

int GetTotal(int a, int b, out int avg){   //out int  이렇게 선언을 꼭 해줌.

avg = (a + b) / 2;

return a + b;

}

// Update is called once per frame

void Update () {

}

}



'Computer Language > 유니티' 카테고리의 다른 글

아이템 배열 Out 을 참조  (0) 2014.04.14
parameter  (0) 2014.04.14
폴딩(함수 접기 & 보기)  (0) 2014.04.14
배열과의 전쟁  (0) 2014.04.14
3의 배수 찍기  (0) 2014.04.14

+ Recent posts