4 ms·
Of course, but so can C++ and Java: https://stackoverflow.com/a/29709521 https://stackoverflow.com/a/29709521
by meindnoch 4y ago
Of course, but so can C++ and Java: https://stackoverflow.com/a/29709521 https://stackoverflow.com/a/29709521
- musicale 4y agoImplicit main in Swift means you don't need "public static void main..." or other boilerplate. No reason why Java and C++ couldn't do something similar though.
- astrange 4y agoTop level programming is actually a little too surprising in Swift. For instance, you can access variables before they're declared - so you're not just implicitly inside a main function.
- runjake 4y agoRight, but unlike C++ and Java, the scriptability of Swift was designed by spec. It's not a hack or convolution.
- teh64 4y agoJava being used as a script is now also built in (since Java 11 in 2018): https://nipafx.dev/scripting-java-shebang/ https://nipafx.dev/scripting-java-shebang/