toSquareOrNull

open override fun toSquareOrNull(): Square?

Creates a new instance of Square from this regular polygon if the sideCount is equal to 4, otherwise returns null.