Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / <> comparison is always false

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. <> comparison is always false
#12527
Posted by: Michael S 2008-11-27 17:53:50 Last edited by: Jeff Glatt 2009-03-04 14:06:41 (Total edited 1 time)
Run the following:
y = '          '
DO WHILE y <> ''
	y = STRIP(y)
END
SAY 'Finished'	
The loop ends immediately (ie, not even one iteration).
Message2.
#12530
Posted by: Jeff Glatt 2008-11-28 01:47:39
The comparison operator <> is not a strict operator. That means, it trims leading and trailing spaces off the strings before doing the comparison. So if you take a string that is all spaces, it gets trimmed down to an empty string. And of course, the two empty strings are equal.

If leading/trailing spaces are important, then use a strict operator such as \==.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,800.00 ·
 
 
¥489.00 ·
 
 
¥288.00 ·
 
 
¥908.00 ·
 
 
¥748.00 ·
 
 
¥264.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0