Your Ad Here

Sunday, March 15, 2009

How to use methods using return values

The below code describes how to use methods using the return values
Ex: file_name : packet.e

<’

struct packet_s {

length: uint;

legal: bool;

legal_value (len: uint): bool is {

If (length >= len) then {

Result = TRUE;
};

If (result = FALSE) then {

legal = FALSE;
};
};

length_calc() is {

var length_incr : uint := 0;

if (length == 0) then {

length_incr = length_incr + 1;
};

// call the Legal_value method

legal_value(length_incr);
};

run() is also {

length_calc() ; // Need to call this method as it is calling other method

};
};

‘>

No comments:

Post a Comment