Blitz3D+ Command Reference

End Type

Parameters

None.

Description

Ends a Type definition.

Every Type block finishes with End Type. Between the two go the Field declarations that describe what each object of that type holds.

There is nothing to configure here - it is simply the closing bracket of the definition. Leaving it out gets you a compile error at whatever line the compiler eventually gives up on, which is often nowhere near the actual Type block, so it is worth typing the pair together before filling in the fields.

Once End Type is reached the type exists and you can start making objects with New.

See also: Type, Field, New, Delete.

Example

; End Type Example
; ----------------

Type Enemy
    Field name$
    Field hp
; End Type closes the definition once all the Fields are listed
End Type

; The Type is now ready to use - create a couple of enemies
e.Enemy=New Enemy
e\name="Scout"
e\hp=20

e.Enemy=New Enemy
e\name="Brute"
e\hp=80

Print "The enemy squad:"
For e.Enemy=Each Enemy
    Print "    "+e\name+" has "+e\hp+" hp"
Next

Print ""
Print "Press any key to close the example"
WaitKey

End

Index