what is the difference between raise and print? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is the difference between raise and print?

23rd Jun 2016, 4:35 AM
ģž„ģ •ģ„­
ģž„ģ •ģ„­ - avatar
2 Answers
+ 1
Raising an errorĀ halts the entire program at that point (unless the exception is caught), whereasĀ printingĀ the message just writes something toĀ stdoutĀ -- the output might be piped to another tool, or someone might not be running your application from the command line, and theĀ printĀ output may never be seen.
23rd Jun 2016, 7:11 AM
Neelapu Harsha Vardhan Reddy
Neelapu Harsha Vardhan Reddy - avatar
+ 1
raise is used for raising exceptions. And print is used to for output
27th Jun 2016, 5:21 PM
Narendra Ram