Why hello() .. shouldn't it be main() ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why hello() .. shouldn't it be main() ??

4th Nov 2016, 8:59 AM
sahag
sahag - avatar
3 Answers
0
You can write main() if you want to. For this case, it doesn't matter.
4th Nov 2016, 9:08 AM
Tauki Tahmid
Tauki Tahmid - avatar
0
its not compulsory to write it outside of main but what will happen when you want to use this function in your another function like you have created a function in main and it used to get factorial of any number. You created another function that find value of sine. You need to use factorial to find sine value. You cannot access function in main. You have to write one function two times. Want to waste time, and call yourself a programmer.
4th Nov 2016, 9:09 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
you can do it, but it is not a Good idea. a language is better with better practices.
4th Nov 2016, 10:09 AM
Julio Cezar
Julio Cezar - avatar