Subject: XploRe: Learning Guide
See XploRe:

Quantlet: quant10
Description: Signum - branching.
Download: quant10.xpl

Code:
  proc() = signum(x)       ; defines a procedure named "signum"

    switch                 ; opens the switch branch
      case (x > 0) 
        "positive number"  ; output in the case that x > 0
        break 
      case (x < 0) 
        "negative number"  ; output in the case that x < 0
        break                   
      default
        "number is zero"   ; output in the case that x = 0
        break
    endsw                  ; end of the switch branch
  endp                     ; end of the procedure
;
  signum(10)               ; runs the procedure with value 10
  signum(-5)               ; runs the procedure with value -5
  signum(0)                ; runs the procedure with value 0

Subject: XploRe: Learning Guide
See XploRe:

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