llength not returning correct list size

旧巷老猫 提交于 2021-01-29 15:18:11

问题


I have a list which has the elements below.

test = {a[1] b[60] c[25] c[36]}

I am checking the length of test as below:

set result [llength ($test)]

This is giving me the error below:

list element in braces followed by ")" instead of space

What could be the issue?

Thanks in advance.


回答1:


You might need to review the basics of Tcl syntax

Don't put parenthesis around the argument to llength.

set x {test = {a[1] b[60] c[25] c[36]}}
set result [llength $x]

In future questions, it is better to post an entire program that can be executed so that your error can be reproduced easily.



来源:https://stackoverflow.com/questions/62128382/llength-not-returning-correct-list-size

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!