mint
mint copied to clipboard
`Window.prompt` should distinguish between empty Ok and Cancel
// JavaScript
const answer = window.prompt("What's your name?","");
const greeting = answer === null ? "How rude!" : answer ? `Hello, ${answer}!` : "I'll call you Darth";
alert(greeting);
// Mint
sequence {
greeting = sequence {
answer = Window.prompt("What's your name?","")
if(answer == ""){
"I'll call you Darth" // Never happens
} else {
"Hello, #{answer}!"
}
} catch String => reason {
"How rude!"
}
Window.alert(greeting)
}
In JavaScript, if the User selects 'Ok' without entering anything, the alert is "I'll call you Darth". In Mint, that condition never happens.