# Question!

• September 4th, 2013, 05:39 PM
Lillionette
Question!
Hi what does this mean 5 + '7' + 2, i am pretty new to all this so please be patient with me, i write it down in the interactions window, and get 62. So far i know its some kind of math question, but what does it mean to write something in " ' ' "
• September 4th, 2013, 05:58 PM
Ubiquitous
Re: Question!
When something is encased in '' it defines it as character.
Something encased in " " defines it as a string.

char someChar = 'b'; // Can only contain a single character
String someString = "This is a string"; // A string is just a collection of chars

I hadn't seen an equation like that but if I were to guess why it works is that the compiler is taking the dec value of the char and adding it into the equation. So it probably does 5 + value of char + 2. Someone with more experience will chime in and explain it better.
• September 4th, 2013, 07:47 PM
jps
Re: Question!
Quote:

Originally Posted by Ubiquitous
So it probably does 5 + value of char + 2.

:-bd
• September 5th, 2013, 04:29 AM
syedbhai
Re: Question!
Hello.
If a character say c is enclosed in single quotes as 'c' then the expression 'c' returns the ASCII code of the character c.
So in your expression 5+'7'+2, three values are added: 5, ascii value of 7 which is 55, and 2.
So the sum comes to 62.

Syed.