function is situated in a file called main.rs or lib.rs. // In `main.rs` fn main() { println!("Hello, World!"); } Additionally, as of Rust 1.26.0, the main function may return a Result: fn main() -> Result<(), std::io::Error> { println!("Hello, World!"); Ok(()) // Return a type `Result` of value `Ok` with the content `()`, i.e. an empty tuple. } Swift When run in an Xcode Playground, Swift behaves like a scripting language, executing statements from top to bottom; top-level code is allowed.// HelloWorld.playground let hello = "hello" let world = "world" let helloWorld = hello + " " + world print(helloWorld) // hello worldCocoa- and Cocoa Touch-based applications written in Swift are usually initialized with the @NSApplicationMain and @UIApplicationMain attributes, respectively. Those attributes are equivalent in their purpose to the main.m file in Objective-C projects: they implicitly declare the main function that calls UIApplicationMain(_:_:_:_:) which creates an instance of UIApplication. The following code is the default way to initialize a Cocoa Touch-based iOS app and declare its application delegate.// AppDelegate.swift import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } } Visual Basic In Visual Basic, when a project contains no forms, the startup object may be the Main() procedure. The Command$ function can be optionally used to access the argument portion of the command line used to launch the program: Sub Main() Debug.Print "Hello World!" MsgBox "Arguments if any are: " & Command$ End Sub Xojo In Xojo, there are two different project types, each with a different main entry point. Desktop (GUI) applications start with the App.Open event of the project's Application object. Console applications start with the App.Run event of the project's ConsoleApplication object. In both instances, the main function is automatically generated, and cannot be removed from the project. See also crt0, a set of execution startup routines linked into a C program Runtime system References External links Hello from a libc-free world! (Part 1) , March 16, 2010 How main method works in Java Control flow Computer programming .NET programming languages Software