From cubranic at stat.ubc.ca  Mon Aug 23 19:06:06 2010
From: cubranic at stat.ubc.ca (Davor Cubranic)
Date: Mon, 23 Aug 2010 10:06:06 -0700
Subject: [Rd] small syntax suggestion
In-Reply-To: <AANLkTinwC0h+oX2QhcskS_9xRuws=X9XQ2RuGnOxVCyG@mail.gmail.com>
References: <AANLkTimvja3=JJ-Y8yS=8K+m8ePP7XrCUTEvzg=L9bjn@mail.gmail.com>
	<AANLkTinwC0h+oX2QhcskS_9xRuws=X9XQ2RuGnOxVCyG@mail.gmail.com>
Message-ID: <04831FEE-4137-484E-8942-427085663D2F@stat.ubc.ca>

On 2010-08-23, at 6:15 AM, Barry Rowlingson wrote:

> On Sun, Aug 22, 2010 at 4:33 PM, ivo welch <ivo.welch at gmail.com> wrote:
>> I have found that my students often make the mistake of
>> mixing up comparisons and assignments with negative numbers:
>> 
>>  if (x<-3) do_something;
> 
> If you tell your students not to use '<-' for assignment, then they
> can't make this mistake, because = for assignment has additional
> restrictions on it:

The students are trying to *compare* to a negative number, and trip on R's parsing of "<-". They could use '=' for assignment all they want (which I thought is being discouraged as a code style these days, BTW), and they'll still run into this problem.

Davor


[Rd] small syntax suggestion
Davor Cubranic