This is from the section of passing values by output. In this question, can anyone explain how console line is executed?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

This is from the section of passing values by output. In this question, can anyone explain how console line is executed??

static void GetValues(out int x, out int y){ x = 5; y = 42; }static void Main(strings[] args) {int a, int b; GetValues(out a, out b); Console. WriteLine(a+" "+b) ;}

2nd Nov 2016, 6:02 PM
Uplabdhi Singh
Uplabdhi Singh - avatar
3 Answers
+ 1
Can you clarify this a bit more? I'll try to maybe answer your question. It would print out 5 42 because a and b take on the values of x and y in the GetValues method. So, it prints out 5 space 42. Does this help?
2nd Nov 2016, 6:12 PM
Benjamin McKissick Jr.
Benjamin McKissick Jr.   - avatar
+ 1
Console.WriteLine is what writes and displays text to the console window. It also includes a carriage return or new line delimiter. Console.Write on the other hand doesn't include a carriage return.
2nd Nov 2016, 8:02 PM
Benjamin McKissick Jr.
Benjamin McKissick Jr.   - avatar
0
I want to ask that what is the meaning of console. Writeline... Statement in this code?
2nd Nov 2016, 6:16 PM
Uplabdhi Singh
Uplabdhi Singh - avatar