How to write if else statement in laravel 8

  laravel, laravel-8

See I can write some code in PHP I want to write the same code in laravel-8 how can I?
My PHP code

<td>
<?PHP
   if($Runs>0 and $Balls==0){
      echo $Runs*100;
   }elseif($Balls>0 and $Runs==0){
      echo $Balls*$Runs;
   }elseif($Balls==0 and $Runs==0){
      echo $Balls*$Runs;
   }
    elseif($Runs>0 and $Balls>=0){
      echo $Runs/$Balls*100;
   }
?>
</td>

I want to write this same code in laravel-8
This is what I can do

<td>
{{ $value->runs/$value->balls*100 }}
</td>

I can’t write if else condition there How can I?

Source: Laravel

Leave a Reply