1
Want to increment one more? (yes/no) [no]:
yes
counter = 1
Want to increment one more? (yes/no) [no]:
yes
counter = 2
Want to increment one more? (yes/no) [no]:
in the
Completed search.
1
Want to increment one more? (yes/no) [no]:
yes
counter = 1
Want to increment one more? (yes/no) [no]:
yes
counter = 2
Want to increment one more? (yes/no) [no]:
in the
Completed search.
2
//Para fazer isso, podemos usar um laço while, da seguinte maneira:
public function handle()
{
$contador = 0;
$confirmado = true;
while ($confirmado) {
if ($this->confirm('Deseja incrementar mais um?')) {
$contador++;
$this->info('contador = : '.$contador);
} else {
$confirmado = false;
}
}
}
Browser other questions tagged php laravel artisan
You are not signed in. Login or sign up in order to post.
This does not seem to be a recursive problem. Just a repeat loop already meets your need:
while ($this->confirm('...')) { ... }
– Woss
Yes @Woss agree, but you can put all your logic into while, the detail is that I saw someone with this doubt and one person said they had no way to ask sequential questions, but I didn’t find her post anymore!
– Douglas Oliveira