new

From Kolmafia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Syntax: new record ( param, ... );

record is the record to use.

Returns an instance of the given record, filling each field of the record with the given parameters. Each unspecified field is then filled with the default value of that type. For the default values of various types, see Data Types.

For instance:

record dblstr{
   string a;
   string b;
};

dblstr test;
test.a = "hello";
test.b = "world";

is functionally identical to

record dblstr{
   string a;
   string b;
};

dblstr test = new dblstr("hello","world");


Furthermore,

record strint{
   string a;
   int b;
};

strint test = new strint("hello");

will create a record as follows:

test.a => "hello"
test.b => 0

Formatting Needed