class TestCase::Statement::While {
  use TestCase::Minimal;

  static method condition_my_var_mem_id : int () {
    
    # Assing an object in condition
    {
      my $strings = ["a", "b", undef];
      my $i = 0;
      while (my $string = $strings->[$i]) {
        $i++;
      }
    }
    
    while (my $uchar = 5) {
      my $is_char = 10;

      my $num = 1;
      
      unless ($uchar == 5) {
        return 0;
      }
      last;
    }
    
    while (my $uchar = 5) {
      my $is_char = 10;

      my $num = [1];
      
      unless ($uchar == 5) {
        return 0;
      }
      
      $uchar;
      
      last;
    }
    
    return 1;
  }
  
  static method basic : int () {
  
    my $success_while = 0;
    {
      my $total = 0;
      my $i = 0;
      while ($i <= 3) {
        $total = $total + $i;
        $i++;
      }
      
      if ($total == 6) {
        $success_while = 1;
      }
    }
    
    unless ($success_while) {
      return 0;
    }
    
    return 1;
  }
  
  static method next : int () {
    
    my $i = 0;
    my $total = 0;
    while ($i < 5) {
      
      if ($i == 3) {
        $i++;
        next;
      }
      
      $total += $i;
      
      $i++;
    }
    
    unless ($total == 7) {
      return 0;
    }
    
    return 1;
  }

  static method last : int () {
    
    my $i = 0;
    my $total = 0;
    while ($i < 5) {
      
      if ($i == 3) {
        last;
      }
      
      $total += $i;
      
      $i++;
    }
    
    unless ($total == 3) {
      return 0;
    }
    
    return 1;
  }

  static method condition_my : int () {
    
    my $num = 5;
    while (my $num = 3) {
      if ($num == 3) {
        return 1;
      }
      else {
        return 0;
      }
    }
    return 0;
  }
}
