Why do some of the examplsle codes written in ' ' form but also in " " | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why do some of the examplsle codes written in ' ' form but also in " "

Semi colon

28th Feb 2019, 10:48 AM
Leonard Gadali
Leonard Gadali - avatar
4 Answers
+ 4
Depends on the language. Mostly it does not matter. In php the variables are recognized in " " but in ' ' not.
28th Feb 2019, 11:00 AM
SouthPoleHillbilly
SouthPoleHillbilly - avatar
+ 2
Because it's sometimes necessary. For example you will face problem if you only use "" for setting an attribute in html. //Error and not functional: button.onclick = "function("red")"; //Fixed code and functional: button.onclick = "function('red')";
28th Feb 2019, 10:57 AM
Parsa Gholipout
Parsa Gholipout - avatar
+ 1
Thank you soo much
28th Feb 2019, 11:14 AM
Leonard Gadali
Leonard Gadali - avatar
+ 1
Usually ' ' are used for single characters (letters), and " " are used for strings. Im most languages it doesn't really matter, but it depends
28th Feb 2019, 11:42 AM
Matthias
Matthias - avatar