NISUS Archives

May 2011

NISUS@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Þorvarður Davíðsson <[log in to unmask]>
Reply To:
Date:
Tue, 31 May 2011 11:47:01 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (46 lines)
On 31.05.2011, at 02:51, Philip Spaelti wrote:

> 
> So in your line:
>>> Type text $startNumber+1 & '.    '
> 
> You are trying to increase $startNumber and concatenate the result with the string '.    ', that's two operations. So no go.


Good that you remind me of this important limitation. Now I just have to make sure I don’t forget it again. :-)

The error message that popped up was something about a "," missing to join the arguments. Would it be possible for NWP to detect if more than one operation is on a line and then display a warning stating that only one operation is allowed? If that is possible then I think we should maybe send a feature request to Nisus Software because the error message I got was not helpful for the user.


> The most "logical" way to increase variables in NWP syntax is to do it like this:
> 
> $variable += 1
> 
> So, adopting Bob's renaming suggestion, for you case you might write it like this:
> 
>> $rowNumber = 1 # this is the 'start number'
> 
>> $rowNumber += 1 # increase the row number by 1


This method is indeed new to me. Thanks for writing it down here. I may have picked up the (old) method

$rowNumber = 1
$rowNumber = $rowNumber + 1

in HyperCard a long time ago and in a way it looks logical too.


> 
> Another way to write the 'Type' line is this
> 
>> Type text "$rowNumber.    "
> 
> By using double quotes you can get interpolation. So NWP first 'figures out' what is in the quotes and then types it. In this case it figures out what $rowNumber is  then it types the value followed by '.    ' Interpolation is one of those place where you get to cheat the one operation limit a little bit, though here it isn't really necessary.
> 
> Just some ideas


As always, your ideas are very helpful Philip. Thanks a lot.

Þorvarður

ATOM RSS1 RSS2