I dont understand the purpose of strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I dont understand the purpose of strings

Plz help

16th Aug 2019, 5:50 AM
Engr Anees Ur Rehman
Engr Anees Ur Rehman - avatar
6 Answers
+ 3
A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings. Even "12345" could be considered a string, if specified correctly. Typically, programmers must enclose strings in quotation marks for the data to recognized as a string and not a number or variable name. For example, in the comparison: if (Option1 == Option2) then ... Option1 and Option2 may be variables containing integers, strings, or other data. If the values are the same, the test returns a value of true, otherwise the result is false. In the comparison: if ("Option1" == "Option2") then ... Option1 and Option2 are being treated as strings. Therefore the test is comparing the words "Option1" and "Option2," which would return false. The String() function converts the value of an object to a string
16th Aug 2019, 6:18 AM
Safaa Alnabhan
Safaa Alnabhan - avatar
+ 1
Strings are used to store text. Like this: "This is a string". They can also (in newer languages) be in ''. Like 'Some text'.
16th Aug 2019, 6:09 AM
Paul Grasser
Paul Grasser - avatar
+ 1
Do you mean the normal strings or the function of string?
16th Aug 2019, 6:12 AM
Safaa Alnabhan
Safaa Alnabhan - avatar
+ 1
The main purpose of having data types or have a different keyword for each data type is to make functions more specific with less errors .. your question is kind of strange ☺
16th Aug 2019, 6:21 AM
Safaa Alnabhan
Safaa Alnabhan - avatar
0
Thanks safaa aLnabhan
21st Aug 2019, 1:29 AM
Engr Anees Ur Rehman
Engr Anees Ur Rehman - avatar
0
I am a new user to learn programing
21st Aug 2019, 1:30 AM
Engr Anees Ur Rehman
Engr Anees Ur Rehman - avatar