From fed142996cb79cff4579d5d283c3b75517cb5d5e Mon Sep 17 00:00:00 2001 From: Sarah Haggarty Date: Mon, 31 Jul 2023 17:24:38 +0200 Subject: [PATCH] update: clarify primary constructor definition --- docs/topics/classes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/topics/classes.md b/docs/topics/classes.md index 00582834f72..79dce881e05 100644 --- a/docs/topics/classes.md +++ b/docs/topics/classes.md @@ -16,7 +16,7 @@ class Empty ## Constructors -A class in Kotlin can have a _primary constructor_ and one or more _secondary constructors_. The primary constructor is a +A class in Kotlin has a _primary constructor_ and possibly one or more _secondary constructors_. The primary constructor is a part of the class header, and it goes after the class name and optional type parameters. ```kotlin @@ -29,8 +29,8 @@ If the primary constructor does not have any annotations or visibility modifiers class Person(firstName: String) { /*...*/ } ``` -The primary constructor cannot contain any code. Initialization code can be placed in _initializer blocks_ prefixed with -the `init` keyword. +The primary constructor initializes a class instance and its properties. Initialization code can be placed in _initializer +blocks_ prefixed with the `init` keyword. During the initialization of an instance, the initializer blocks are executed in the same order as they appear in the class body, interleaved with the property initializers: