30
loading...
This website collects cookies to deliver better user experience
class ApostarNoBixo
{
const AVESTRUZ = 1; /* 1 */
const AGUIA = 2; /* 2 */
/* ...restante dos bichos ... */
const URSO = 23;/* 23 */
const VEADO = 24;/* 24 */
const VACA = 25;/* 25 */
}
$apostandoNoBixo = new ApostarNoBixo();
jogarNoBixo($apostandoNoBixo::AGUIA);
function jogarNoBixo(int $aposta): string {
if($aposta <= 25 && $aposta > 0) {
return match ($aposta) {
23 => 'Acertou' . PHP_EOL,
default => "Errouuuuu" . PHP_EOL
};
} else {
return 'Aposta inválida, dinheiro do Bixeiro.';
}
}
enum PossiveisApostasNoBicho: int
{
case AVESTRUZ = 1; /* 1 */
case AGUIA = 2; /* 2 */
/* ...restante dos bichos ... */
case URSO = 23;/* 23 */
case VEADO = 24;/* 24 */
case VACA = 25;/* 25 */
}
function jogarNoBixo(PossiveisApostasNoBicho $aposta): string
{
return match ($aposta) {
PossiveisApostasNoBicho::URSO, 23 => 'Acertou' .
default => "Errouuuuu" . PHP_EOL
};
}
print "Resultado". jogarNoBixo(PossiveisApostasNoBicho::URSO); // Acertou