Page 1 of 1

Undocumented feature if and exclamation mark

PostPosted: Fri Oct 21, 2016 10:09 am
by HPW
Hello,

Is there a undocumented feature with if and exclamation mark?
I find 3 cases in the doc where the exclamation mark has special meaning.
Does it make if argument-variables case-sensitiv?

Code: Select all
SetVar "[t1]" "Ruby"
SetVar "[t2]" "RUBY"

Alertbox "![t1]" "![t2]"
Alertbox "[t1]" "[t2]"

If "![t1]" "<>" "![t2]"
 Alertbox "Result1" "Strings are indeed different."
Else
 Alertbox "Result1" "Strings are equal."
EndIf

If "[t1]" "<>" "[t2]"
 Alertbox "Result2" "Strings are indeed different."
Else
 Alertbox "Result2" "Strings are equal."
EndIf


Regards

Re: Undocumented feature if and exclamation mark

PostPosted: Sun Oct 23, 2016 11:08 am
by Neosoft Support
The exclamation point tells NeoBook to leave the contents of the parameter alone and not modify it at all.

Re: Undocumented feature if and exclamation mark

PostPosted: Mon Oct 24, 2016 8:01 am
by HPW
The exclamation point tells NeoBook to leave the contents of the parameter alone and not modify it at all.

The doc says that math operations are not resolved. What about variable replacment?

The sample code show the variables gets resolved and replaced by the content.
But the if condition behaves different.
When I Change t1 and t2 to exact the same string "Ruby" then both if show the same result.

Regards

Re: Undocumented feature if and exclamation mark

PostPosted: Mon Oct 24, 2016 9:12 am
by virger
Grandioso, utilisimo, comprobado
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=PushButton1
X=21
Y=14
W=226
H=41
Anchor=0
Text=[ab1[c]] --- [ab2[c]]
Align=2
ImageStyle=0
ObjAction=setvar "[abc1]" "1,2,3,4,5,6,7,8,9,0,q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,ñ,á,í,ó,ú,"¶strupper "[abc1]" "[abc2]"¶strparse "[abc1]" "," "[ab1]" "[x]"¶strparse "[abc2]" "," "[ab2]" "[x]"¶loop "1" "[x]" "[c]"¶    if "![ab1[c]]" "=" "![ab2[c]]"¶        alertbox "Dif" "[ab1[c]] --- [ab2[c]]"¶    endif¶endloop
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Tahoma
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=1

Re: Undocumented feature if and exclamation mark

PostPosted: Mon Oct 24, 2016 8:42 pm
by Neosoft Support
Variables are always resolved and are not affected by the exclamation point.

Re: Undocumented feature if and exclamation mark

PostPosted: Tue Oct 25, 2016 5:33 am
by Gaev
This subject (of the handling of ! Exclamation Mark) deserves a (Pinned) Topic on these Forums ... so we can add all sorts of examples (and how each one is resolved) ... all in one place.

Later, perhaps replicated to the Help file.

Re: Undocumented feature if and exclamation mark

PostPosted: Wed Oct 26, 2016 9:55 am
by dpayer
Gaev wrote:This subject (of the handling of ! Exclamation Mark) deserves a (Pinned) Topic on these Forums ... so we can add all sorts of examples (and how each one is resolved) ... all in one place.

Later, perhaps replicated to the Help file.



Ditto (an American expression meaning "I agree with what was said " )

David P.