How to Determine Variable's Data Type?

Is there any way to test the data type in a variable?

I am loading data objects (Lists) from stored variables and sometimes they only contain one item. In that case, the List length property returns how many characters are in that one item rather than returning the value of 1 (only one item in the List).

Any suggestions?


There are different methods to determine the type of data in the variable. You need a good knowledge of data types and operations that are allowed on the data of different types.

  1. If you add a variable to 0, and as a result will not NaN, then the variable is a number or numbers in a string form else the variable in not a bumber
  2. If the string representation of the extreme characters [], it is an array (list)
  3. If the string representation extreme {} symbols or string [object Object], it is the object

and so on.

In some blocks Thuinkable X type conversion is performed automatically, while other types do not produce conversion. For this reason, the definition of the type of data yThe eye can lead to an error.

If you are interested in the details, you can see it


Thanks for the info!
I’ll try to isolate a case, (but it probably won’t happen for a few days).

I think in your block may have an error. List length block returns the length of item when it is string and not a list.

The interesting thing is that the red and blue block length of work the same way and can be returned as a list the length and string length.

1 Like