We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How about using a ~ prefix to denote mutable variables (and make all vars immutable by default?)?
~
I experimented with ChatGPT a bit:
fn bubble_sort(~vec) { let len = ~vec.len() let ~swapped = true while swapped { swapped = false for i in 1..len { if ~vec[i - 1] > ~vec[i] { let temp = ~vec[i - 1] ~vec[i - 1] = ~vec[i] ~vec[i] = temp swapped = true } } } } fn main!() { let ~unsorted = [4, 2, 7, 1, 9, 5] println("Unsorted Array: {unsorted}") let sorted = bubble_sort(unsorted) println("Sorted Array: {sorted}") } main!()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How about using a
~
prefix to denote mutable variables (and make all vars immutable by default?)?I experimented with ChatGPT a bit:
The text was updated successfully, but these errors were encountered: