Creating many reference variables side by side

Hello everyone. I can create many reference variables in my program. For this I can use scopes eg. But how convenient is this code for other developers? I mean, would that be the correct coding style? Or is there another way to do this?
e.g my code:

let mut var = String::from("some text");

    let rvar1 = &mut var;
let rvar2 = &mut var;

The code example you gave doesn't actually do anything, so it's hard to say whether it's a good idea or not. Long lists of statements can sometimes be improved by breaking it up into {} blocks, but at the same time having too many just creates unnecessary levels of indentation. Therefore I wouldn't say to particularly avoid or use them; just do whatever you find most readable.

1 Like

@Kestrer Thanks :slight_smile:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.