Monday, October 29, 2012
Struct
static void Collection_Struct (Args _args)
{
//Create a struct with two fields
struct myCar = new struct ("int ModelYear; str Carbrand");
int i;
;
// Set values to the fields
mycar.value ("ModelYear", 2000);
mycar.value ("Carbrand", "BMW");
// Add a new field and give it a value
myCar.add ("Model", "316");
//Loop through the fields of the struct
for ( i = 1; i <= myCar.fields(); i++)
{
info ( strfmt ( "FieldType: %1, FieldName: %2, Value: %3",
myCar.fieldType ( i ), myCar.fieldName ( i ), myCar.Value ( myCar.fieldName ( i ))));
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment