Skip to content

Conversation

@oscarArismendi
Copy link

Added a sample function for constructors in Library.kt.

These are just the basics, but I remember when I was learning Kotlin that having examples for everything would’ve made me spend more time in the official documentation.

Related issue: KT-20357

@oscarArismendi oscarArismendi changed the title KT-20357: Add sample usages for array constructor functions in standa… KT-20357: Add sample usages for array constructor functions Oct 14, 2025
@oscarArismendi
Copy link
Author

Hi, just checking if I need to do anything else to move this toward review
cc @derekxu16 @SmialyKot @Tapchicoma @ddolovov @woainikk @anton-bannykh

/**
* Returns an array containing the specified [Double] numbers.
*
* @sample samples.collections.Arrays.Constructors.doubleArrayOf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update corresponding actual declarations.

class Constructors {
@Sample
fun doubleArrayOf() {
val doubleArray = doubleArrayOf(1.0, 2.5, 3.14)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to showcase that these functions produce an empty array when invoked without any arguments. WDYT?

@fzhinkin fzhinkin added the Standard Library Sample Pull request with samples for stdlib API label Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Standard Library Sample Pull request with samples for stdlib API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants