length operator in TW5.1.20pre

58 views
Skip to first unread message

Mohammad

unread,
Feb 22, 2019, 3:35:14 PM2/22/19
to TiddlyWiki
Look at below test code

<$vars x=>
<$text text={{{ [<x>length[]] }}}/>
</$vars>

Testing on https://tiddlywiki.com/prerelease/ results in 

4


what is going wrong?

--Mohammad

Diego Mesa

unread,
Feb 22, 2019, 4:38:12 PM2/22/19
to TiddlyWiki
Hey Mohammad,

If you put a <<x>> in there before the $text, you can see that as you have it, x is "true", which is why length returns 4.

TonyM

unread,
Feb 22, 2019, 5:01:20 PM2/22/19
to TiddlyWiki
What a nice way to write obscure code.

Test for len 4 or len 5 for true false!

Regards
Tony

Mohammad

unread,
Feb 23, 2019, 2:23:34 AM2/23/19
to TiddlyWiki
Diego,
Thank you for clarification.

 But when you code, this is error prone!

--Mohammad

Mohammad

unread,
Feb 23, 2019, 2:26:02 AM2/23/19
to TiddlyWiki
Tony

 This took a lot of time to debug a code! Undefined variable or wrongly assigned.
 We really need a good TW documentation. 

--Mohammad

TonyM

unread,
Feb 23, 2019, 5:09:24 AM2/23/19
to TiddlyWiki
Mohammad,

I know how you feel, yet I do not have too many problems now, in part because I write code progressivly. I would have placed x=<<x>><br> in there as soon as it did not do as expected.

I will try and capture some of these design and debug methods and share.

Regards
Tony

Reply all
Reply to author
Forward
0 new messages