Noob Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Noob Question

In challange question Which of the data types takes a number.. Why is string not an answer?

9th Sep 2020, 5:48 AM
Abhinav Krishnan TK
Abhinav Krishnan TK - avatar
3 Answers
+ 2
I'm not sure what programming language this relates to but short, int, long, float, double are common numeric data types in a few languages. string is best for text. Converting a string to an int or double takes time and it might not be possible to convert. What number does "Hello" represent? Aside from NaN(Not a number), nearly every value if not all values in a short, int, long, float, or double are valid numbers.
9th Sep 2020, 5:52 AM
Josh Greig
Josh Greig - avatar
+ 1
It c#..
9th Sep 2020, 5:53 AM
Abhinav Krishnan TK
Abhinav Krishnan TK - avatar
0
Abhinav, the types in the previous answer work for c# then. c# has short, int, long, float, and double.
9th Sep 2020, 5:59 AM
Josh Greig
Josh Greig - avatar