I'm learning F# from just a few days, so here's a newbie question:
I've learn to declare a new type this way:
type GameEntity =
{
Position : Vector3<m>
Velocity : Vector3<m/s>
Acceleration : Vector3<m/s^2>
}
(Vector3 and Meausure are declared somewhere else.. this works fine). Now I would like to declare another type that stores inside it a list of GameEntity. I tried something like this:
type GameWorld =
{
name : string;
entities : GameEntity = [] //error
}
Could someone show me the right syntax to declare a list(entities) of a previous defined type (GameEntity) ?
You can use:
entities : GameEntity list
or
entities : List<GameEntity>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With