Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: DavidW
« on: June 20, 2022, 09:37:21 PM »

Ah. OK, that makes sense. Just a special case of - being a pain. Sorry for false alarm.
Posted by: Wisp
« on: June 20, 2022, 09:48:32 AM »

It comes down to ambiguous grammar. Quote the variable name and the code works, or include whitespace, because then the ambiguity is gone.
 
Posted by: Argent77
« on: June 19, 2022, 04:44:03 PM »

It looks like whitespace is important. This code works as expected:
Code: [Select]
OUTER_SET x = 10
OUTER_SET x -= 2
PRINT "%x%"  // output: 8

Without whitespace around the operator, WeiDU treats "x-" as the variable name that has been assigned the value 2.
Code: [Select]
OUTER_SET x-=2
PRINT "%x-%"  // output: 2
Posted by: DavidW
« on: June 19, 2022, 04:24:44 PM »

OK, this one surprised me. var1 -= var2 is supposed to abbreviate var1=var1 - var2. Unless I am seriously confused, it doesn't do anything.

e.g.

Code: [Select]
OUTER_SET x=10
OUTER_SET x-=2
PRINT "%x%"
Should be 8, actually is 10.