Is here an error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is here an error

string word = "slt"; if (word[0]="s") Console.Write("!!!");

20th Sep 2022, 12:04 PM
TheMasterBee
TheMasterBee - avatar
3 Answers
+ 1
Hi! This is python or JavaScript?
20th Sep 2022, 12:25 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
You can find out yourself by running it in the code playground. Equal signs in a if statement should be a double equal == = is for value assignent == is for comparison
20th Sep 2022, 2:59 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
TheMasterBee It is customary to identify which language in the question tags. In this case I figured out that it is C#. The code has a couple of common mistakes: One is that of using an assignment operator (=) instead of a comparison operator (==). Another is that of using a string delimiter (double quote - ") on a char type instead of a character delimiter (single quote - ').
21st Sep 2022, 6:31 AM
Brian
Brian - avatar