Ruckus
05/27/2021, 5:14 PMfun main(args: Array<String>) over fun main(vararg args: String)?randomcat
05/27/2021, 5:21 PMrandomcat
05/27/2021, 5:21 PMmain explicitly?Ruckus
05/27/2021, 5:52 PMmain explicitly"? I pass parameters into many of my programs regularly when I run them.randomcat
05/27/2021, 5:53 PMmain directly from Kotlin coderandomcat
05/27/2021, 5:53 PMRuckus
05/27/2021, 5:55 PMmain directly, but for some strange reason I find the vararg variant far more aesthetically pleasing when reading the source.randomcat
05/27/2021, 5:55 PMRuckus
05/27/2021, 5:58 PMvararg just looks so good for some reason... 🙂Ruckus
05/27/2021, 5:58 PMrandomcat
05/27/2021, 6:32 PMShawn
05/27/2021, 6:37 PMrandomcat
05/27/2021, 6:39 PMpublic static void main(String[] args). fun main(args: Array<String>) is the direct translation of that into Kotlin. It's also how the docs define main https://play.kotlinlang.org/byExample/01_introduction/01_Hello%20worldShawn
05/27/2021, 6:50 PMrandomcat
05/27/2021, 6:51 PMrandomcat
05/27/2021, 6:51 PMShawn
05/27/2021, 6:51 PMrandomcat
05/27/2021, 6:52 PMShawn
05/27/2021, 6:53 PMrandomcat
05/27/2021, 6:53 PMrandomcat
05/27/2021, 6:54 PMShawn
05/27/2021, 6:54 PMRuckus
05/27/2021, 6:54 PMmaina in IntelliJ generates the Array version, it's probably safe to assume it's considered the more idiomatic of the two.Alex Nordlund
05/28/2021, 9:36 AMRuckus
05/28/2021, 2:37 PMSourabh Rawat
06/01/2021, 3:42 PMArray is much easier to understand that vararg.
"Hey it's an array of arguments"
Vs
"Hey it's vararg? Hmm whats the type of it? Is it list? Array? Never mind, at least it says several args, so an Iterable, aha!"