by weinzierl · 7y ago · 0 comments
> The PM said MPs will now get a vote on whether the UK should leave without a deal on 29 March and, if that fails, on whether Brexit should be delayed.
What happens if they vote "No" three times in a row (no deal, no no-deal, no postponement)?
If this wasn't politics I'd say: See if you can simplify this function, bonus points if you can avoid error conditions too:
func brexit(){
if(deal){
exit(deal);
} else {
if(!deal) {
exit(null);
} else {
if(postpone){
wait(TIME);
brexit();
} else {
throw new handsInTheAir();
}
}
}
} func brexit(){
if(deal){
exit(deal);
} else {
if(!deal) {
exit(null);
} else {
if(postpone){
wait(TIME);
brexit();
} else {
exit(null);
}
}
}
}
However, this is subject to change. Motions can (and will) be amended.But, by design, exceptions don't automatically propagate from Parliament to its parent (the citizens) so the process is currently wedged in some kind of undefined behaviour. And no-one has the privileges to HUP the job.
void choices()
{
if(uk_MPs_yes_vote(12_march))
{
brexit(29_march[current_deal]);
}
else if(uk_MPs_yes_vote(13_march))
{
brexit(29_march[no_deal]);
}
else if(uk_MPs_yes_vote(14_march))
{
if(EU_yes_vote(21_march))
{
brexit(extension_date);
}
}
else if(uk_MPs_yes_vote(22_to_29_march))
{
brexit(29_march[current_deal]);
}
else
{
brexit(1/0);
}
}So the smart-arse new junior programmer, Clegg, refactored something he did not understand. The code review by Cameron signed it off to be pushed live.
We now pay the consequences. Repeatedly.
Did it in one line.