0
Why is the value of name in colons & the value of age, not in colons?
Is this because we don't want to call value of age in the output?
4 Antworten
+ 3
Colons? You mean quotes maybe? Because it is different data types. Quotes means you use string, number without quotes is integer or float number. It is hard to explain shortly, you should read some tutorial about data types in programming.
0
So in short, if you want to use any data(number/text etc) you use quotes, if you want only numbers, you use integers if non decimal, or float if in decimals. Is this correct?
0
In short - yes. For example, if you do "1"."2" operation (strings joining also known as concatenation) you will get result "12" and if you do 1+2 you will get result 3.
0
Ok lets see how I might explain this. When you use "" (or '')(i.e. quotation marks) the output is what's called a string variable. So if I put numbers between "" e.g. "3" that means that all I get is the text, also knows as the string variable, i.e. I won't use the number for a sum or to represent something else.
String variables just represent the text, so that's your output.
NOW if I want to use the number in some other way, like in maths (or could be used in many other ways but to keep it simple I'll stick with this explanation) then you don't put it in "". So here as 25 is representing the variable age you don't put it into ""
Hope that makes it a bit clearer!