Subject: XploRe: Learning Guide
See XploRe:

Quantlet: quant13
Description: Optional input and output parameters in a procedure.
Download: quant13.xpl

Code:
  proc(a,b)=myquant3(x,y)
    error(exist(x)<>1, "input x is not numeric!")

    if (exist(y)==0) ; y does not exist
      y=0
    endif

    switch
      case (exist(y)==2) ; if y is a string
        a=x
        break
      case (exist(y)==1) ; if y is numeric
        a=x
        b=y
        break
      default;
        error(1, "y is neither numeric nor string!")
        break
    endsw
  endp
;
  result=myquant3(1,2)
  result
;
  result=myquant3(1)
  result
;
  result=myquant3(1,"hallo")
  result

Subject: XploRe: Learning Guide
See XploRe:

© MD*Tech - Method and Data Technologies, generated on 6.6.2000 .