CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • vararg in a signature: why it exists and what the call looks like

    Kotlin SELF
    Level 16, Lesson 0
    We break down the vararg parameter in Kotlin: why it’s needed, 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().
    Available
  • Vararg signature rules: order, named args, and default values

    Kotlin SELF
    Level 16, Lesson 1
    Let’s 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 what rule applies when you omit parameters that have default values. At the end— a quick reference on parameter order and a list of common mistakes.
    Available
  • Spread *: pass arrays into vararg without errors

    Kotlin SELF
    Level 16, Lesson 2
    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 get a set of typical mistakes and quick rules so you don’t get stuck on type mismatches.
    Available
  • The contract of vararg functions: empty input, ...OrNull, and require

    Kotlin SELF
    Level 16, Lesson 3
    Let’s break down why vararg functions must have an explicit contract for “empty input”: 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”.
    Available
  • Designing mini utilities with vararg

    Kotlin SELF
    Level 16, Lesson 4
    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 “bundles” of strings and numbers, move configuration into parameters after vararg (via named arguments), and properly forward argument bundles via the spread operator * when building chains of utilities ( printBlock, log, info/ error).
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym