The result won't be shown in console
1. Code (Where result won't be shown in console)
2. Code (Everything normal)
41 Replies
Well
You didn’t call the method
Console.WriteLine($"The result of h: {h}");
I did
No
I mean Data2
You didn’t call that
PrintWeatherData?
It works, why?
That is not Data2
Well
That works because you called that in Main
The program executes everything in Main() starting from the top
You did not call that method in Main
hm
In the Main method, do _Data1.Cals.Data2()
Like just put that there
Where we name the method?
No inside your Main method
It’s where the program starts executing
it gives me bunch of errors
1.) That is not Main and
2.) Make Data2 static
still not shown
That is not Main
Where is your main method????
Like the method actually named Main
Remove that from Data2 and put it in Main
Why I should name my method as "Main"? I don't have any method which are named Main
Yes you do
oh wait
you mean
from weatherdata?
Yeah that
What about it
Yes !!
That is the method
It doesn't conflicts
Put it there
oh
What
ohhhh
Okay i got it
Are you following a tutorial out of curiosity?
what tutorial
No I’m asking you if you’re following a tutorial
No, i wrote that code by myself
like i tried to test my skills
Like we shouldn't sit and learn learn we should could and take experience etc
I still need to put smth to there??
Ohhh I see I see
You need to understand the concept of the main method. It's the entry point to your code, where the computer starts to run it
It must exist
Oh yeah public ig
I know that, but I just don't understand why it's not showing
Because you didn’t call it
In the main method
That was why
The method was never called
A method not called does nothing at all, ever
?
If main, or a method called from main, don't call a method.... Then it's not part of the code execution flow
This can go to any depth or be conditional etc, but it's still true
nooope
not there
in where it was defined
okay you should really
follow a turorial
but idk the tag
it's already public
it doesnt look public here
oh you mean that one
?
wait it static
that seems fine now
thats the "method signature" as we call it
now you just need to call that method from your main method