652
functions (lemmy.nz)

cross-posted from: https://lemmy.ml/post/39334581

you are viewing a single comment's thread
view the rest of the comments
[-] joyjoy@lemmy.zip 14 points 1 year ago* (last edited 1 year ago)

Kotlin also lets you do fun x() = y()

[-] spongebue@lemmy.world 5 points 1 year ago

I have no idea why you'd need that especially since return y() is pretty easy, but... I want it!

(Actually, I guess a super simple way of overloading a method, like fun x() = x(defaultValue) could be neat)

[-] eager_eagle@lemmy.world 4 points 1 year ago* (last edited 1 year ago)

default values is one of my pet-peeves after using Python regularly. I wish more languages would let you just do something like def do_thing(arg=default_value) without hoops like builder pattern, function overloading, or whatnot

[-] PoolloverNathan@programming.dev 2 points 1 year ago

(Kotlin does support that, with the same fun do_thing(arg: Int = 2) syntax.)

load more comments (4 replies)
load more comments (6 replies)
load more comments (6 replies)
this post was submitted on 22 Nov 2025
652 points (98.7% liked)

Programmer Humor

34344 readers
1052 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS