Why break statement has errors inside user-defined function? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why break statement has errors inside user-defined function?

break;

18th Nov 2019, 1:57 PM
John Emmanuel Piga
John Emmanuel Piga - avatar
5 ответов
+ 6
Can you provide an example?
18th Nov 2019, 2:03 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 3
Seeing ur code.. It looks like u don't know where to use break... Break statement is used to terminate loop... For, while, do-while... And in switch case..... How can u use it in else block of ur code
18th Nov 2019, 2:27 PM
Saurabh B
Saurabh B - avatar
+ 2
Break is used for terminating loops... And return is used for terminating a function in simple words
18th Nov 2019, 2:32 PM
Saurabh B
Saurabh B - avatar
18th Nov 2019, 2:25 PM
John Emmanuel Piga
John Emmanuel Piga - avatar
0
To end your program, you should use break statement (but this is only a problem on user-defined functions).
18th Nov 2019, 2:28 PM
John Emmanuel Piga
John Emmanuel Piga - avatar