You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnmain(){use std::env;// Prints each argument on a separate linefor argument in env::args(){println!("{}", argument);}}
This is a papercut: could we just indent all lines by four spaces? Ideally we'd show the code in the playground with indentation that looks pretty similar to code in a full program.
An alternative option would be to run rustfmt when code is sent to the playground. This risks changing the formatting of the example, which potentially surprising to readers. The advantage of this is that it works with multiline string literals too:
// indenting every line by 4 spaces here would change the value oft he stringlet x = "";
The text was updated successfully, but these errors were encountered:
For example, https://doc.rust-lang.org/std/env/fn.args.html includes the following code sample:
However, the run button produces this URL:
https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Aenv%3B%0A%0A%2F%2F%20Prints%20each%20argument%20on%20a%20separate%20line%0Afor%20argument%20in%20env%3A%3Aargs()%20%7B%0A%20%20%20%20println!(%22%7B%7D%22%2C%20argument)%3B%0A%7D%0A%7D
which gives the following code in the playground:
This is a papercut: could we just indent all lines by four spaces? Ideally we'd show the code in the playground with indentation that looks pretty similar to code in a full program.
An alternative option would be to run rustfmt when code is sent to the playground. This risks changing the formatting of the example, which potentially surprising to readers. The advantage of this is that it works with multiline string literals too:
The text was updated successfully, but these errors were encountered: