Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Newbie in Perl class > I don't understand the task

Expand Messages
  • Jenda Krynicky
    From: Karen Nadalin ... Maybe they meant my @array = (1, 2, 3, 4, 5); for(my $i = 6; $i
    Message 1 of 4 , Oct 2, 2008
    • 0 Attachment
      From: "Karen Nadalin" <kznadalin@...>
      > I'm a bit desperate to locate a resource that can help me understand
      > this assignment. I've plowed through a number of reading assignments,
      > searched online to understand "for loop" and I still don't quite get
      > what I' supposed to do. I need a push in the right direction.
      >
      > Task:
      > Start with an array (1, 2, 3, 4, 5) and use a for loop to get the
      > array to be equal to (1, 2, 3, 4, 5, 6, 7, 8). Display the result.
      >
      > If anyone has a resource or helpful tip so I can understand what I'm
      > to do, I thank you.
      > Karen

      Maybe they meant

      my @array = (1, 2, 3, 4, 5);

      for(my $i = 6; $i <= 8; $i++) {
      push @array, $i;
      }

      Jenda
      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    Your message has been successfully submitted and would be delivered to recipients shortly.