Hacker News new | ask | show | jobs
by TezlaKoil 2951 days ago
Scientists say that there's a considerable but not overwhelming chance that the volcano on my island might erupt in the next few days.

If I knew that the volcano is going to erupt, then I would drive to the airport (with all my belongings, and leave).

If I knew that the volcano on my island is not going to erupt this month, then I would drive to the airport (to go on a package holiday that I had planned).

However, if the outcome is undetermined, I might prefer to cancel my holiday (I would not enjoy it while worrying about all my stuff potentially being destroyed in a fiery inferno) and wait to see what happens. So I should hesitate from driving to the airport.

1 comments

In this example the two "drive to airport" actions are different.

    If (volcano_status == GONNA_BLOW)
        pack_everything_and_run();
    else if (volcano_status == NO_WORRIES)
        pack_suitcase_and_leave_for_holiday();
    else if (volcano_status == UNKNOWN)
        cancel_holiday();
It depends on what you treat as a complete action. One could equally well decompose it as two actions and two conditionals:

if (volcano_status == GONNA_BLOW) refuel_car(); else if (volcano_status == NO_WORRIES) refuel_car(); else if (volcano_status == UNKNONW) nop();

then later

if (volcano_status == GONNA_BLOW) pack_everything_and_run(); else if (volcano_status == NO_WORRIES) pack_suitcase_and_leave_for_holiday(); else if (volcano_status == UNKNONW) call_to_cancel_holiday();

Then refueling the car is definitely the same action, even if it's followed by different actions later on.