How to declare multiple variables? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to declare multiple variables?

14th Jun 2016, 10:46 PM
Utpal Kumar
Utpal Kumar - avatar
11 Answers
+ 13
You can declare multiple constants or multiple variables on a single line, separated by commas: var a = "swift 1.0", b = "swift2.0", c = "coming soon"
14th Jun 2016, 11:20 PM
Shimul Debnath
Shimul Debnath - avatar
+ 2
you can declare multiple constants on a single line let x=1.1,y=1.5
15th Jun 2016, 7:30 AM
Vijay Gurav
Vijay Gurav - avatar
+ 1
yes we can do
16th Jun 2016, 6:22 PM
Sunil kumar cheni
Sunil kumar cheni - avatar
+ 1
yes
7th Jul 2016, 2:07 PM
Jhon Alex
Jhon Alex - avatar
+ 1
You can declare multiple variable by seprating them through comma Example: var x, y
9th Jul 2016, 2:54 PM
MOHD FAIZAN UMAR
MOHD FAIZAN UMAR - avatar
+ 1
use comma operator that's it to define multiple constants
12th Jul 2016, 4:35 AM
Biplove Ansh
Biplove Ansh - avatar
+ 1
You can declare multiple variables in same line if they are same type var a, b, c: Int or var a: Int, b: Float, c: String
31st Aug 2016, 8:11 AM
EsG.G.
0
Anyone?
14th Jun 2016, 10:46 PM
Utpal Kumar
Utpal Kumar - avatar
0
likho likho sab log same answer likho.. instead of that you can use up or down.. cheers
12th Jul 2016, 6:02 AM
Sonowal Rituparna
Sonowal Rituparna - avatar
0
well done guys. keep that up
1st Feb 2018, 9:37 PM
Raid
- 1
Idk
22nd Aug 2016, 11:15 PM
Abby
Abby - avatar