JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Success stories
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • vararg in a signature: why you need it and what a call looks like

    Kotlin SELF
    16 level,0 lecture
    We break down the vararg parameter in Kotlin: why it exists, what a call with any number of arguments looks like (including f()), why inside the function it’s “almost an array” (you can use size, indices, and indexing), what limitations exist (only one vararg), and how to apply it in practice—from utilities like say()/ hint() to a simple debug().
    Open
  • Vararg signature rules: order, named args, and default values

    Kotlin SELF
    16 level,1 lecture
    We break down how to design signatures with vararg in Kotlin: why the “tail” of arguments is almost always placed at the end, what happens when vararg is not last (and why named arguments are then required), how default values and named args work together, and which rule applies when you skip parameters with default values. At the end— a cheat sheet on parameter order and a list of typical mistakes.
    Open
  • Spread *: passing arrays into vararg without errors

    Kotlin SELF
    16 level,2 lecture
    We break down why you can’t “just” pass an array into a vararg parameter, how the spread operator * works in Kotlin, how Array<T> differs from primitive arrays like IntArray, when toTypedArray() is required, and how to correctly forward vararg to other functions. At the end, you’ll find a set of common mistakes and quick rules so you don’t get stuck on type mismatches.
    Open
  • Vararg function contract: empty set, ...OrNull, and require

    Kotlin SELF
    16 level,3 lecture
    We break down why vararg functions must have an explicit contract for the “empty set”: when it makes sense to return a neutral value, when it’s better to provide a ...OrNull version and return null, and when it’s more correct to fail immediately via require(...). Along the way: common traps like xs [ 0 ], the Elvis operator ?:, the spread operator *, and examples from the mini app “Guess the Number”.
    Open
  • Designing mini utilities with vararg

    Kotlin SELF
    16 level,4 lecture
    We break down how to design small console utilities in Kotlin so that the code in main reads like a script. We learn to use vararg for “sets” of strings and numbers, move configuration into parameters after vararg (via named arguments), and properly forward argument sets through the spread operator * when building utility chains ( printBlock, log, info/ error).
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success stories
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush