처봅니다.
제가 지금까지는 한 function에 한개의 Result만 필요했었거든요.
function fname(inputParam):Boolean;
begin
fname := Result;
end;
procedure pname();
begin
if fname(inputParam) then
begin
end;
end;
이케 했었거든요. 근데 프로그램을 짜다보니깐 값하나얻을때마다
function을 하나씩 만들려니깐 귀찮아서
function fname(inputParam,output1,output2):Boolean;
begin
fname := Result;
output1 := Result1;
output2 := Result2;
end;
procedure pname();
begin
if fname(inputParam,output1,output2) then
begin
value1 := output1;
value2 := output2;
end;
end;
이케 할려구 했는데...되나여?
함수를 써서 결과값을 한개이상 나오게 할려면 어케 해야 합니까?
비베에서는 되거든여.. 이거 어렵네..
> 처봅니다.
> 제가 지금까지는 한 function에 한개의 Result만 필요했었거든요.
>
> function fname(inputParam):Boolean;
> begin
> fname := Result;
> end;
>
> procedure pname();
> begin
> if fname(inputParam) then
> begin
>
> end;
> end;
>
> 이케 했었거든요. 근데 프로그램을 짜다보니깐 값하나얻을때마다
> function을 하나씩 만들려니깐 귀찮아서
> function fname(inputParam,output1,output2):Boolean;
> begin
> fname := Result;
> output1 := Result1;
> output2 := Result2;
> end;
> procedure pname();
> begin
> if fname(inputParam,output1,output2) then
> begin
> value1 := output1;
> value2 := output2;
> end;
> end;
>
> 이케 할려구 했는데...되나여?
> 함수를 써서 결과값을 한개이상 나오게 할려면 어케 해야 합니까?
> 비베에서는 되거든여.. 이거 어렵네..
포인터타입을 써서 구현하는 방법이 있구요. 아님 변수를 var타입으로 선언하실 수도 있죠.. var는 비베에두 아마도.. 있었던거 같은데.. 예전에 잠시 써봤거덩요.. ^^;
var를 쓰면 function이 아니라 procedure만으로 구현이 가능해지죠.
procedure testProc(a: char; var b, c: Integer);
begin
b := 0;
c := 0;
case a of
'1':
begin
b := 1;
c := b;
end;
'2':
b := 2;
c := b;
begin
end;
end;
end;
procedure UseTestProc;
var
t2, t3: Integer;
begin
testProc('1', t2, t3);
showmessage(inttostr(t2) + ':' + inttostr(t3));
end;