Makes an instance of an object and initializes it.
[ @Shared ] [ New ] class_name [ type_list ] #object_name [ , argument_list ] [ Begin [ default_type | Call method_name ] statements End [ New | class_name ] ]
- Optional – There can be only one instance.
- Optional keyword.
- Mandatory name of a class.
- Optional – See Type List for more information.
- Mandatory name for the object.
- Optional – One or more expressions with a comma between each.
- Optional start of the block construct.
- Optional data type that the compiler will use for the subsequent statements, if the data type is not certain.
The data type must be related to the type specified in a constructor of
- Optional name of the method to call for each
statement. It must come after the keyword
- Mandatory in the block construct, one or more object-creation statements. See the section “Permitted members” for more information.
- Completes the block construct.
You can also use one of
- an argument list, which is treated like the arguments to a
Changes in syntax with @Option
There are two areas where you can change the syntax of the statement:
@Option New With Newand
@Option New Without New
@Option End With Blockand
@Option End Without Block
See @Option Directive for more information.
' Find all text files in current directory Files #fs, "*.txt"
' Create a menu. Menu #file, "&File", "&Open...", DoOpen, |, "E&xit", DoExit
New Menu #File, "&File" Begin "&Open...", DoOpen |---- "E&xit", DoExit End New
Menu #File, "&File" Begin "&Open...", DoOpen |---- "E&xit", DoExit End Menu