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 specified.
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 seen as the arguments to
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 the current directory. Files txtFiles, "*.txt"
' Make a menu. Menu FileMenu, "&File", "&Open...", DoOpen, |, "E&xit", DoExit
New Menu FileMenu, "&File" Begin "&Open...", DoOpen |---- "E&xit", DoExit End New
Menu FileMenu, "&File" Begin "&Open...", DoOpen |---- "E&xit", DoExit End Menu