How would I make a create a program in C# that rolls 2 die in a method and then returns a result to the main method?

In my class, we are starting to delve into methods, and I just cannot wrap my head around them for some reason. I've looked over multiple website tutorials, but I just cant understand it. One of our labs is as follows:

For this lab, create a method (separate from your main method) that "rolls" two six side dice, and then calculates the result. That result should be returned using return. In your main program, just have the system roll the dice 5 times (by calling the method 5 times) and display the results.

I know this is probably super simple stuff, but I can't wrap my head around it. I'm not specifically asking anyone to give me the program, I'm mostly just asking for a simple explanation of methods. Although, I would heavily appreciate it if someone could, as imo, I learn stuff like this better by looking at a physical example. Thanks



Read more here: https://stackoverflow.com/questions/67393447/how-would-i-make-a-create-a-program-in-c-sharp-that-rolls-2-die-in-a-method-and

Content Attribution

This content was originally published by identity7 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: