I need to do something that in C I would do like this:
int get_x_value() {
static int x = -1;
if (x == -1) {
// Code to calc the value
x = 5;
}
return x;
}
What is the equivalent in Rust?
I need to do something that in C I would do like this:
int get_x_value() {
static int x = -1;
if (x == -1) {
// Code to calc the value
x = 5;
}
return x;
}
What is the equivalent in Rust?