🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.perl
Article #422

Re: for czy foreach?

#422
From: Piotr Piatkowski
Date: Thu, 03 Jul 1997 14:47
21 lines
1164 bytes
Piotr Roszatycki <dexter@delta.ii.tuniv.szczecin.pl> wrote:
: Kiedy uzywa sie for, a kiedy foreach (oczywiscie wtedy, gdy parametrem jest
: tablica?)

: Zdaje sie, ze nie ma zadnej roznicy i zalezy to od stylu programowania, ale
: moze sa jakies wytyczne?

Zgadza się - to są synonimy. Osobiście zwykle używam:

foreach $x ( @y )

i 

for( $x = 0; $x < 10; $x++ )

z tym że zamiast tego drugiego i tak piszę zwykle

foreach $x (0..9)

-- 
Piotr Piątkowski, Uczelniane Centrum Informatyki, AGH Krakow, POLAND
Technical Details
Message-ID: <5pge2h$608$1@galaxy.uci.agh.edu.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!ict.pwr.wroc.pl!agh.edu.pl!agh.edu.pl!not-for-mail
References: <33bba071.0@zeus.man.szczecin.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!ict.pwr.wroc.pl!agh.edu.pl!agh.edu.pl!not-for-mail
From: kompas@galaxy.uci.agh.edu.pl (Piotr Piatkowski)
Newsgroups: pl.comp.lang.perl
Subject: Re: for czy foreach?
Date: 3 Jul 1997 16:47:45 +0200
Organization: University of Mining & Metallurgy
Lines: 21
Message-ID: <5pge2h$608$1@galaxy.uci.agh.edu.pl>
References: <33bba071.0@zeus.man.szczecin.pl>
NNTP-Posting-Host: galaxy.uci.agh.edu.pl
Mime-Version: 1.0
X-Newsreader: TIN [UNIX 1.3 unoff BETA 970307; sun4m SunOS 5.5.1]
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit