proomt

Search

Search posts, papers, and topics

All posts

Ray Wenderlich1 min readtutorialintro

Kodebits Day 93: Default Parameter [FREE]

Summary

A brief Swift tutorial demonstrating default parameters with a simple `greet` function, showing how omitted arguments use the default value.

  • Default parameters let you omit arguments and have the compiler supply a fallback value.
  • In Swift, you declare defaults in the function signature (e.g., `times: Int = 1`).
  • Calling `greet("Alice")` prints once; `greet("Bob", times: 2)` prints twice.

Understanding default parameters is a basic language feature; knowing the syntax helps write cleaner APIs, but the article offers no deeper design discussion or performance considerations.

3/10

Related reading

  1. Kodebits Day 76: Elvis Operator [FREE]

    A short Kodebits tip introduces Kotlin’s Elvis operator for handling nullable values, showing how it supplies a default when the left side is null. It’s a quick reminder for Android developers working with null‑safety.

    Ray Wenderlichkodeco.com1 min