Skip to content

Instantly share code, notes, and snippets.

@ryanpcmcquen
Created July 17, 2020 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanpcmcquen/46d7a8449ce8d966623d0bce4fef9d89 to your computer and use it in GitHub Desktop.
Save ryanpcmcquen/46d7a8449ce8d966623d0bce4fef9d89 to your computer and use it in GitHub Desktop.
Create an array with sequentially incremented items.
let mut a = [0; 900];
for (index, element) in a.iter_mut().enumerate() {
*element = index;
}
println!("{} {} {}", a[23], a[700], a[1]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment