java:
Код: Выделить всё
public record Vehicle(String brand, String licensePlate) {}
Код: Выделить всё
type Vehicle =
{
Brand : string
LicensePlate : string
}
< /code>
На языках ML можно «обновить» запись, создав копию с несколькими изменениями значений: < /p>
let u =
{
Brand = "Subaru"
LicensePlate = "ABC-DEFG"
}
let v =
{
u with
LicensePlate = "LMN-OPQR"
}
// Same as:
let v =
{
Brand = u.Brand
LicensePlate = "LMN-OPQR"
}
Подробнее здесь: https://stackoverflow.com/questions/660 ... ith-syntax