-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Moving from #2.
Consider
if (const a = Math.random() < .5) {
console.log(a); // definitely works
console.log(b); // definitely throws
} else if (const b = Math.random() < .5) {
console.log(a); // works?
console.log(b); // definitely works
} else {
console.log(a); // works?
console.log(b); // works?
}What should the three works? lines do?
For background, in C++,
#include <iostream>
using namespace std;
int main() {
if (bool a = false) {
cout << a << endl;
} else if (bool b = false) {
cout << a << endl;
cout << b << endl;
} else {
cout << a << endl;
cout << b << endl;
}
return 0;
}is a legal program.
Metadata
Metadata
Assignees
Labels
No labels