What does this line mean? What for "out size"? The rest is clear) | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

What does this line mean? What for "out size"? The rest is clear)

(! int. TryParse(Console. ReadLine(), out size) || size<1)

15th Nov 2017, 8:55 PM
Валерия
Валерия - avatar
2 Antworten
+ 11
out is used to pass variables by reference (so when the method is done, the variables are still changed). TryParse returns two values. It returns a boolean, for if the parse worked or not. If the parse does work, it also returns the value it just converted (and stores it in the 'out' variable).
15th Nov 2017, 9:05 PM
Tamra
Tamra - avatar
+ 1
size is the name of the variable where the return value from out is stored.
16th Nov 2017, 2:58 AM
stellacaerulea
stellacaerulea - avatar