Syntax help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Syntax help

Hi, I need help with the C# syntax. The lessons I have went through haven't covered this yet. My problem is that I am using another compiler, but I cant get the syntax to work correctly. Also, the namespace is different... I don't know what namespace does either. If anyone can help it would be greatly appreciated.

17th Jan 2020, 5:14 PM
Topmat
Topmat - avatar
6 Answers
+ 4
I think you may have better chance if you could explain the situation more descriptively. Take a look at your post. "My problem is that I am using another compiler" What compiler? "But I can't get the syntax to work correctly" Did you actually mean the code? but there is no detail here, was there any error message? if so, what did it say? "Also the namespace is different" AFAIK we decide a title for the namespace ourselves, except you were referring to something else. All this confusion and possibility for misunderstanding can be mitigated had you shared the code link within the question Description. Follow the guide below on how to share links 👍 https://www.sololearn.com/post/74857/?ref=app
17th Jan 2020, 5:54 PM
Ipang
+ 2
Sorry about the bad post. It didn't occur to me that it wasn't informative. Anyway, 1. The compiler I am using is "Mini C#Pro". 2. Yeah, maybe it isnt the syntax, it is the code. But I still don't know what exactly to use... Like when I tried to code "Hello World". The Console.WriteLine doesn't work. Is that because of the namespace? 3. The namespace that it defaults to is "MiniCSharp"
17th Jan 2020, 6:17 PM
Topmat
Topmat - avatar
+ 2
Thanks for elaborating, TBH I don't know that compiler, but never mind. Any compiler that processes code to IL correctly should do I guess. And sorry for delay, timezone issue : ) Can you please save a copy of the code in SoloLearn and share the link? I still don't see your code. People need to see the code before they can say whether there was any syntactical problem. Or possibly other problem. I seriously doubt your namespace title has anything to do with the code not executing well, disregarding the title for the namespace.
18th Jan 2020, 4:52 AM
Ipang
+ 2
i agree namespace andconpiler are unlikely to be the cause. Try putting a Console.ReadLine(); at the end of your code just to make sure your console isnt disapearing too quickly. Above all else, sharing code and compiler or run time error messages will be tge most helpful way to help us help you.
18th Jan 2020, 10:30 AM
SQrL
SQrL - avatar
+ 2
inside here, put public void main(){ Console.WriteLine(“Hello World”); }
18th Jan 2020, 3:37 PM
SQrL
SQrL - avatar
+ 1
I can't transfer the code directly, so I will retype it. Since this compiler is just an free Android app, this also might be the problem. This is what it says using an "empty template". using System; using System.Text; namespace MiniCSharp { public class Util { } }
18th Jan 2020, 2:27 PM
Topmat
Topmat - avatar