Why doesn't Int take's double comma like String does? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesn't Int take's double comma like String does?

8th Aug 2016, 10:21 PM
Amr Ezz
Amr Ezz - avatar
6 Answers
+ 1
An integere only takes numbers like -2;-1; 0;1; 2; 3;... A string can be everything. (letters, numbers, commas,...) But you can't add two strings or do other calculations with them, because for the computer a string is just a serie of signs and not a number.
12th Aug 2016, 1:46 AM
simon
+ 1
int is a datatype used for integers....string is a datatype used for series of characters.... like abc.....@#a etc.....like most programming languages java also.... has a datatype int which can store whole no + or - since it is only a no it is stored without double quotes...... string stores data within double quotes....
15th Aug 2016, 3:23 AM
Amandeep Singh
Amandeep Singh - avatar
+ 1
we write strings in a double quotes just to distinguish the keywords from your string. you can have strings like if,while,static... and so on the keywords of the respective languages. if we don't give quotes the compiler will give an error saying syntax error or l value required or the respective error.
16th Aug 2016, 5:38 AM
Manisha Bandagi
Manisha Bandagi - avatar
0
Can you give an example of what you mean by "double comma"?
11th Aug 2016, 1:57 AM
MoC
0
we can not do below in the code. Why? sayhello("david","dhoni","kohli");
12th Aug 2016, 4:18 AM
Harshil Soni
Harshil Soni - avatar
- 2
because youve got a brain demention
10th Aug 2016, 7:07 PM
komornik