Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Entry point
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Rust=== In Rust, the entry point of a program is a function named <code>main</code>. Typically, this function is situated in a file called <code>main.rs</code> or <code>lib.rs</code>. <syntaxhighlight lang="rust"> // In `main.rs` fn main() { println!("Hello, World!"); } </syntaxhighlight> Additionally, as of Rust 1.26.0, the main function may return a <code>Result</code>:<ref>{{cite web |title=Releases.md |url=https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1260-2018-05-10 |publisher=GitHub Rust |access-date=15 February 2019 |archive-date=2015-05-15 |archive-url=https://web.archive.org/web/20150515221302/https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1260-2018-05-10 |url-status=live }}</ref> <syntaxhighlight lang="rust"> 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. } </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)