forked from shadowfacts/shadowfacts.net
Correct declare_variable example
This commit is contained in:
parent
2abf6344d3
commit
b3502f257f
|
@ -72,8 +72,12 @@ impl Context {
|
|||
}
|
||||
|
||||
fn declare_variable(&mut self, name: &str, value: Value) {
|
||||
if self.variables.contains_key(name) {
|
||||
panic!("cannot re-declare variable {}", name);
|
||||
} else {
|
||||
self.variables.insert(name.into(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue