Possible to initialize multiple variables from a tuple?

前端 未结 7 470
孤独总比滥情好
孤独总比滥情好 2021-01-17 10:17

In some languages (such as PHP, Haskell, or Scala), you can assign multiple variables from tuples in a way that resembles the following pseudocode:

list(stri         


        
相关标签:
7条回答
  • 2021-01-17 11:01

    You can technically do this with a single statement, rather than two statements, using the following syntax, although the character count is almost identical.

    string firstValue = tupleWithTwoValues.Item1
        , secondValue = tupleWithTwoValues.Item2;
    
    0 讨论(0)
提交回复
热议问题