Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So going back to the original commenter's points: how does Swift handle top-level code? Where is it legal for me to write print("Hello, World")?


Anywhere outside of things like a class or structure definition, if you have a single-file project. In a multi-file project, only in main.swift.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: