return statement | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

return statement

When a function ends with "return true" or "return false" e.g. def myFunct(a, b): x = a*b return False # or return True What is it returning ?

27th Oct 2020, 6:56 PM
Mawande Mbudane
Mawande Mbudane - avatar
5 Antworten
+ 2
Abhay : I would not call the rest useless: example: def func(x): print(fÔÇťgiven: {x}! squared: {x*x}ÔÇť) return True
27th Oct 2020, 8:08 PM
Alexander Thiem
Alexander Thiem - avatar
0
So Jan if we call myFunct(2, 3) we'll just get a boolean value "False" and all the other information within that function is useless?
27th Oct 2020, 7:15 PM
Mawande Mbudane
Mawande Mbudane - avatar
0
Mawande Mbudane yes it is useless ,the final value returned is all that matters ,
27th Oct 2020, 8:00 PM
Abhay
Abhay - avatar
27th Oct 2020, 8:09 PM
Abhay
Abhay - avatar