+ 2

how to declare var in swift?

what is appropriate form of declaration var? var first-name; ir var first_name and why?

17th Jul 2016, 8:54 AM
Arpit Patel
Arpit Patel - avatar
2 Answers
+ 10
var first_name is appropriate, var first-name isn't. Variable names can not have mathematical symbols(like -) and can have underscores(_).
17th Jul 2016, 9:53 AM
Svetlana Milutinović
Svetlana Milutinović - avatar
+ 1
u can do it by writing. var a=10;
13th Aug 2016, 6:21 AM
shahriar hossain