What's the difference, " or '

   1819   2   0
User Avatar
Member
28 posts
Joined: 1月 2014
Offline
Does it matter if I use " or ' for VEX and Hscript? Both works but for sheer curiosity, I would like to clarify the difference.
User Avatar
Member
209 posts
Joined: 3月 2018
Offline
These single quote and double quotes are referred to C/C++ language where single quote is used for single character and the other one is used for multiple characters.
for example:
char sinleChar = 'A';
char multiChar[] = "Hello World";
There's not much differences between them in both VEX and Hscript unless in rare situations where you are dealing with nested strings for instance:
printf("%s", "'Houdini is the best!'");
Which prints:
'Houdini is the best!'
In this case single quotes are included in the string.
But if you try this:
printf("%s", ""Houdini is the best!"");
Houdini gives you an error!
Hope this helps!
Edited by N-G - 2019年9月10日 08:19:27
User Avatar
Member
28 posts
Joined: 1月 2014
Offline
N-G
These single quote and double quotes are referred to C/C++ language where single quote is used for single character and the other one is used for multiple characters.
for example:
char sinleChar = 'A';
char multiChar = "Hello World";
There's not much differences between them in both VEX and Hscript unless in rare situations where you are dealing with nested strings for instance:
printf("%s", "'Houdini is the best!'");
Which prints:
'Houdini is the best!'
In this case single quotes are included in the string.
But if you try this:
printf("%s", ""Houdini is the best!"");
Houdini gives you an error!
Hope this helps!


Perfect, thank you
  • Quick Links