# to bail out vs to back out

In a CS context, I have often come across the expression to back out meaning to say that a function is returned from before performing its actual task, as in this imaginary code comment:

double divide(double dividend, double divisor) {
if (divisor == 0) {
return 0; //divisor is zero => back out early
}
return (dividend / divisor);
}


Now I recently came across the expression to bail out in just the very same context. I know that to bail somebody out generally means to provide funds to get someone out of a difficult financial situation, so I was wondering if the writer confused to back out and to bail out or if to bail out really has this meaning, too.

Has any one ever heard or read a native speaker of English say or write to bail out of a function? Or, if you're a native speaker, would you say to bail out is also correct here?

• This is more about programming, not Computer Science and even more about English language usage.. Below excerpt "The most abrupt way to bail out is by calling the Standard C abort function, as in:" if (something really bad happened) abort(); You can also check at Stack Overflow by searching for "bail out", for example: stackoverflow.com/questions/8311723/… or docs.python.org/3/c-api/intro.html – Evil Mar 8 '20 at 19:04
• Yes, “bail out” is correct here. Check a dictionary. It can be transitive or intransitive. When it's intransitive, it can mean “to get oneself out of a difficult situation”. – Gilles 'SO- stop being evil' Mar 8 '20 at 20:35
• That's a slightly different usage of bail. For this one, see the examples under "phrasal verbs" section 1.1 in lexico.com/en/definition/bail#h70131995116240: "discontinue an activity" – rici Mar 12 '20 at 15:56