|
|
|
|
|
by dfalzone
2160 days ago
|
|
This is pretty minor but I like how in Rust you can use constructs like if-statements and match-statements as expressions. For example: let foo = if some_condition {
"condition is true"
} else {
"condition is false"
};
let bar = match x {
0 => "string",
1 => "another string",
_ => "default"
};
It's not super significant but I think it's an elegant syntactic feature. |
|
Complete sample:
This is almost certainly because RMS is a Lisp hacker. I.e. why GCC uses Lisp notations internally and functions with "mapcar" in the name and such.I discovered it by accident sometime in 1993. I wanted the value of the last expression in a braced block. Maybe it can forced into an expression if you just put parentheses on it? By golly, the intuition worked.
Mainly, it is used in writing macros. Speaking of which: