No need to answer the above question. In the Help File topic for the Let> command, there was this example:jpuziano wrote:And a question for Marcus... perhaps a silly question but I'll ask anyway:
The line below from Gail did not work for me, I had to replace it with the following 2 lines instead:
//Let>nLeftOver=num_blob_chars-(10*nLength)
Let>new=10*nLength
Let>nLeftOver=num_blob_chars-new
Is something wrong with the syntax? When I added the following line after the problem line above:
MDL>nLeftOver
The MessageModal> box displayed the following:
num_blob_chars-(10*nLength)
Why wasn't the number displayed?
- Let>MyVal={5 * 10 + 25}
After some testing and searching for other forum posts here about complex expressions... it seems there is a simple rule that did not sink in for me and perhaps for quite a few others as well. I can't find this rule stated in the Help File... so if its not in there... maybe you would consider adding it in to make it absolutely obvious?
Rule: When assigning a value to a variable using the Let> command, if you have more than two operands to the right of the equals sign = then you must use a complex expression by enclosing everything to the right of the equals sign = with curly brackets.
So the first two lines below are OK because they have two or less operands:operand definition from http://www.webopedia.com/TERM/O/operand.html wrote:In all computer languages, expressions consist of two types of components: operands and operators. Operands are the objects that are manipulated and operators are the symbols that represent specific actions. For example, in the expression
5 + x
x and 5 are operands and + is an operator. All expressions have at least one operand.
- Let>var2=2
Let>MyVal=5*var2
Let>MyVal=5*var2+1
We need this instead:
- Let>MyVal={5*%var2%+1}
We need % symbols around the variables inside a complex expression too... as stated in Help:
So now I see that Gail's original line:As stated in the Help File for the Let> command wrote:The expression must be contained within curly braces "{" and "}". String literals must be delimited with double quotes ("), e.g.: "string". Variables must be delimited with % symbols, e.g.: %VarA%.
- Let>nLeftOver=num_blob_chars-(10*nLength)
- Let>nLeftOver={%num_blob_chars%-(10*%nLength%)}
Sorry for belaboring the point Marcus... its clear for me now... but adding the rule "3 operands or more requires a complex expression" to the Help File might help a lot of others IMO.
Thanks and take care