10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ExpressionsBecause methods can return a value of any type, such as an object or anarray, you can operate on the return value with any operation appropriate tothe return value type. In this syntax example, methodname is a method thatreturns a numeric type like integer or float, allowing you to use the returnvalue in the addition.If a method returns an object, the return value can be manipulated like anyother object. That is, you can use the dot operator (.) to access individualattributes, or you can apply a method to that object.Using the dot operator gets a variable of some kind (depending on the type ofthe attribute), so you can use the resulting variable wherever other variablescan be used. For example, if the addr_meth method returns a variable of classADDR that has an attribute of city, the following expression is legal:objectref.addr_meth().city = 'New York';Nulls in ExpressionsBecause a null cannot be compared to another value, the only test that youcan perform is to see whether it is null or not. To perform this test, use the isnull or is not null operator in a conditional expression. For more information,see Is [Not] Null Operator (see page 46).If any item (other than a reference variable) in an expression has a null value,the value of the entire expression is null, for example:msg = varchar (empno) +' is not a valid employee number';In this expression, if the variable empno has the value null, msg is null afterthe statement executes.If any of the simple variables is null, the result of any comparison involvingthem is null, for example:count = null;if count + 1 > 0 thencallframe newproject;endif;Because count is null, the result of the comparison that includes count is null.Therefore, the callframe statement is never executed.Language Elements 49

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!