How to define multiple variables in single statement

前端 未结 6 744
青春惊慌失措
青春惊慌失措 2021-01-18 07:14

In Python, I can define two variables with an array in one line.

>>>[a,b] = [1,2]
>>>a
1
>>>b
2

How do I do the

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-18 07:49

    When declaring several variables of the same type, you can do the following:

    int a = 1, b = 2, c = 3; //etc.
    

提交回复
热议问题