Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange behaviour with ~variable && ~variable^length > 0, where ~variable = ~getVariable()

See original GitHub issue

Please, take a look at following fiddle:

There, as you can see, are 4 different “ways” to describe logic of checking some value.

First two ways do ~t=item, and second two ways do ~t=getItem(). 1-st and 3-rd ways are checking result in variable with one if tag, as {^{if ~t && ~t^length>0}} ... . 2-nd and 4-th ways are checking result in variable with two if tags, as {^{if ~t}} {^{if ~t^length>0}} ....

The question is: why does jsrender conider result of {^{if ~t && ~t^length>0}} as false in 3-rd example? We think, it is similar to other examples. Is it correct? If it is, then what point do we miss?


Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

BorisMoorecommented, Jul 18, 2017

Yes, good catch, thank you. It is a bug. I am working on a fix. I’ll let you know…

BorisMoorecommented, Aug 26, 2017

Resolved in commit 88

Read more comments on GitHub >

github_iconTop Results From Across the Web

Weird behaviour with variable length arrays in struct in C
There is no variable length array in your code. What you do is called flxeible array member (FAM). How do you think malloc...
Read more >
Really strange behavior using variables in MySql query
MySQL user variables are session-specific. Now why the 5.5 fiddle does not start with NULL - I suppose the fiddle runs EXPLAIN on...
Read more >
Dynamic behavior in Svelte: working with variables and props
In this article we'll be using variables and props to make our app dynamic, allowing us to add and delete to-dos, mark them...
Read more >
Groovy Language Documentation
The reserved keywords can't in general be used for variable, field and method ... if (string!=null && string.length()>0) { result = 'Found' }...
Read more >
Component variables on Unity UI objects - Adventure Creator
GetVariable (12) is the global variable that keeps track of the in-game time. So as time moves forward, most posts will be automatically...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found