Problem with System.Action
Hi, I'm basically a newbie to coding and started a while ago to learn C# and English is not my national language so spare my grammar. I've been countering this for quite a while. Here's the situation :
1. my code didn't have any errors while debugging.
2. it throws an output
System.Action
while it is supposed to be a string that I created.
3. my code might look very messy and unorganized. Any tips may help a lot.
4. I didn't show every code inside cuz it will be very confusing. Basically when the user inputs a key, the minutes
will increase and eventually the timer
will increase.
So I want the output to display the current time and current situation.
5. Any other suggestions or what I did wrong on the code are appreciated.
6. Here's the code : https://pastecode.io/s/oazco37d (I do not know the actual way to post my code since this is my first time posting)
Thanks in advance to whoever uses their time to read this and try to help! You all are the greatest!throws System.Action (oazco37d) - PasteCode.io
I didn't get any error and had searched for a while and couldn't get an answer.
4 Replies
you can paste here the error anyway
you are not calling the method
this
should be this
if it returned a
string
but it doesn't...this part doesn't return string instead it updates the timer field
you can fix that by executing the timer.DisplayTime before printing and print the timer field instead
or change the the return type of the DisplayTime to string
thanks! I didn't really see that I didn't add
()
there.
Thanks for explaining! It makes it so clear now. Btw I couldn't return the value by adding timer
but it works fine just doing return;
, could you explain a bit?it should work if your change the
void
to string
which is the same type as timer
I already explained all of it above