-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于结构化绑定 #7
Comments
表达式是可以很多样化的,只要是支持赋值的左值对象即可 |
似乎文档里没说明哪些表达式“支持赋值”。
就会报错: |
右边必须是数组,谢谢提醒,我会在文档里注明 |
不好意思。“支持赋值的左值对象”有哪里说明吗? |
已补充,谢谢 |
没理解错的话,是指左侧的任何“标识符”是“能够被赋值的左值对象(非临时对象)”吗?比如:
是指 a、b、c 都是“能够被赋值的左值对象”,而不是 a、(b, c)? 另外,确认一下关于表达式的定义, |
左边的格式和右边是相关的,比如 (a, (b, c)) = {1, 2, 3} 就是不合法的,因为右侧的值期待的是 {value, {value, value}} |
这种情况可否举个例子?一时没明白。 |
表达式1 和 2 除了单个变量或者组合之外还可以是哪种结构呢?
比如
(a+b, a-b) = {5, 1}
应该不支持吧?The text was updated successfully, but these errors were encountered: