Klik op het logo voor hulp op afstand
  
 
 
 
 
 
 
 




JoPPS Script Variables


In JoPPS-Script variables are declared implicitly; storage space is dynamically allocated the first time a variable is used.
 
There are no real datatypes in JoPPS-Script; a variable can hold any type of fundamental data:
numeric (integer, floating points, boolean) , alphanumeric (string) and even represent instances of objects. (IDispatch or JoPPS-Script objects)

JoPPS-Script assigns a subtype to each variable during script execution. This subtype can change dynamically each time a new value is assigned to the variable:

a := 10;              /* variable a is of type numeric */
a := "JoPPS";       /* variable a is of type string    */

Although variables can contain any type of data it will often be required to check for the type of data that is stored in a variable to ensure proper script execution.

Datatypes are implied by the use of variables in expressions or by passing variables as parameters to JoPPS-Script functions.

We can divide these variable types into 4 categories:

Variable
type
1 holds a numeric value
floating point, integer, boolean (B-type), date-time value
D-type
2 holds a alphanumeric value
string or character value
S-type
3 holds an object instance
object instance
O-type
4 holds an IDispatch instance
IDispatch object instance
I-type
 
We can verify the type of a variable using the following functions :

IF IsNumber(a) THEN OutputMsg('Is a number');
IF IsString(a) THEN OutputMsg('Is a string');
IF IsObject(a) THEN OutputMsg('Is an object');
IF IsIDispatch(a) THEN OutputMsg('Is an IDispatch instance');
 
/*for objects we can test for a NILL value..*/
IF IsObject(a) && IsNill(a) THEN OutputMsg('The object is NILL');
 
String values (S-type) are always between single (') or double (") quotes.
 
Boolean values (B-type) can be represented using D-type variables: 
 
a := 10;     /* <> 0 = true */
IF a THEN OutputMsg("a is TRUE") ELSE OutputMsg("a is FALSE");
a := 0;      /* = 0 = false */
IF a THEN OutputMsg("a is TRUE") ELSE OutputMsg("a is FALSE");

The language constants TRUE (=1) and FALSE (=0) can be used instead of 0 and <> 0 to represent the boolean values true and false.
 
a := TRUE;  
IF a THEN OutputMsg("a is TRUE") ELSE OutputMsg("a is FALSE");
a := FALSE;
IF a THEN OutputMsg("a is TRUE") ELSE OutputMsg("a is FALSE");

 
Note that the language constant TRUE only represents the value 1, this is not the same as "TRUE" which is actually not zero (<> 0).
 
A variable can be deallocated (freed) by means of the Kill function.

Kill("a");   /* the argument is the name of the variable to free */
 
At the moment JoPPS-Script has no array type.

Variable naming rules:
  • A variable name must begin with an alphabetic character or underscore ("_").  The remainder of the name may contain any alphanumeric characters including underscores.
  • The length of the variable is not limited but should be kept as short as possible to improve readability.
  • Periods may not be embeded in a variable name.
  • A variable name must be unique.
  • Variable names are not case-sensitive. (as JoPPS-Script is not case-sensitive)
     
Variable assignments:
 
To assign a value to a variable use the assignment operator (e.g. := ) in the format  <variable> := <valuegd>.
 
a := 10;                  
b := "JoPPS is great";    
c := TRUE;
e := d := 5.5;
IF (f := (a + d)) THEN OutputMsg(NumToStr(f));
g := Strings.Create();

 

 

 

 

 

 

 




 |  History  |
 
 

 
 
 
TECHWIN SOFTWARE
De Regenboog 11
B-2800 Mechelen
T +32(0)15 44 64 64
T +31(0)30 899 32 15 Nederland