Difference between revisions of "New"

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
(Crappy page, I know, but I'm a bit preoccupied.)
 
imported>PhilmASTErpLus
(Brief explanation. Also, we need to explain what the default value of each type is.)
Line 2: Line 2:
 
Syntax: new ''record'' ( param, ... );
 
Syntax: new ''record'' ( param, ... );
 
: ''record'' is the record to use.
 
: ''record'' is the record to use.
 +
 +
Returns an instance of the given record, where each field is filled with the default value of that type. For the default values of various types, see [[Data Types]].
  
 
For instance:
 
For instance:

Revision as of 17:01, 16 July 2010

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

record is the record to use.

Returns an instance of the given record, where each field is 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");


Formatting Needed