[Thread Prev][Thread Next][Index]

[ferret_users] additional ')' in repeat loop does not lead to error but wrong values



Dear ferreters,


I discovered that an additional round bracket at the end of a repeat statement does not lead to an error that exits the command but instead carries on with wrong / old values. Some statements within the loop are apparently then not executed anymore. 


Here's an example where the loop works as expected:

 	NOAA/PMEL TMAP
 	FERRET v7.1 (optimized)
 	Linux 2.6.32-642.13.1.el6.x86_64 64-bit - 02/15/17
 	 3-Jul-17 17:53     
yes? repeat/range=1:3:1/name=count (def sym count = `count`; say ($count); message)
1
  Hit Carriage Return to continue
 
2
  Hit Carriage Return to continue
 
3
  Hit Carriage Return to continue



Here's an example where the loop has an additional round bracket at the end. The value of the ($count) symbol is not reassigned anymore despite 'def sym count = `count`':

yes? repeat/range=1:3:1/name=count (def sym count = `count`; say ($count); message))
4
  Hit Carriage Return to continue
 
4
  Hit Carriage Return to continue
 
4
  Hit Carriage Return to continue



Listing the variable 'count' as well shows that this values changes within the repeat loop as expected, so just the symbol statement seems to be skipped:

yes? repeat/range=1:3:1/name=count (list count; def sym count = `count`; say ($count); message))
             VARIABLE : constant
          1.000
4
  Hit Carriage Return to continue
 
             VARIABLE : constant
          2.000
4
  Hit Carriage Return to continue
 
             VARIABLE : constant
          3.000
4
  Hit Carriage Return to continue
 


So in this way one might inadvertently end up with wrong values assigned to a symbol, or at least other values than expected.



Best wishes,
Hella




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement