Programming Languages: Psion OPL
Psion Organisers were among the first palmtops which offered plug-in RAM and EPROM chips, and were fully programmable by the user. This simple program prompts the user for the number of cases, then accepts values, and works out the sum, mean, variance, standard deviation. It contains an example of a do...until loop and of an array variable.
Psion Organiser Model XP
NAME:statz
GLOBAL A(20)
GLOBAL J%,I%
GLOBAL B,X,Y,Z,Q
I%=1
CLS
PRINT "CASES: "
  TRAP INPUT J%
IF ERR=206 : RETURN : ENDIF 
IF J% > 20 : PRINT CHR$(16),"TOO MANY CASES" : GET : RETURN : ENDIF
   DO
PRINT "VALUE ",I%
TRAP INPUT B
IF ERR=206 : RETURN : ENDIF
   A(I%)=B
   I%=I%+1
UNTIL I%>J%
  X= MEAN(A(),J%)
  Y= STD(A(),J%)
  Z= SUM(A(),J%)
  Q= VAR(A(),J%)
CLS
PRINT "SUM ",Z
PRINT "MEAN", X
PRINT "STD ", Y
PRINT "VAR ", Q
 GET


Copyright © Christopher Brown-Syed 1995-2001. Disclaimers.