What is the use of def statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of def statement

Even if i can print spam 3 times even without using the def statement?

8th May 2020, 5:04 PM
AMRUTHA B R
1 Answer
+ 1
Def is used to define a function. and function are used when you have the same code that you want it to run with many variables so it's easier and cleaner to use a function. Hope you understand it😊.(this is in python by the way)
8th May 2020, 5:14 PM
Lord Nader
Lord Nader - avatar