I've been leaning PHP.
I made a program, it runs straight down to the end using loops and locks but I recently discovered goto.
Does this mean I can have it jump around and skip sections of code if needed?
Is this a good or bad idea?
Goto is only useful in very specific circumstances.
Fucking wevdevs.
using goto is a bad idea, because you might suddenly switch scopes and fuck your shit up
>>53673748
goto is terrible, shouldn't the concept of object orientation destroy the need for using goto..
That is what functions are for
dumb php devs
Using goto, how would you help Brendan escape alimony?$bank = 25,000,000;
$brendan = 'divorced';
function pay_alimony() {
$bank = $bank - 900,000;
$just = "fuck my shit up";
}
if ($brendan != 'married') {
pay_alimony();
echo $just;
} else {
$just = "give me a clean cut";
}
>>53673896
I would teach Brendan that $just needs to be defined outside of the pay_alimony scope or else its gonna break. Fucking hell brendan...
>>53673896$bank = 100000000;
$brendan = 'single';
goto the_mummy;
$bank = 25000000;
$brendan = 'divorced';
$just = "fuck my shit up";
function pay_alimony() {
global $bank;
$bank = $bank - 900000;
}
the_mummy:
if ($brendan != 'married' && $brendan != 'single') {
pay_alimony();
echo $just;
} else {
$just = "give me a clean cut";
echo $just;
}
>>53673748
The usage of goto was deprecated decades ago. Use proper flow control.