If in a ruby file I define a function like so:
def tell_the_truth()
puts "truth"
end
is there an equivalent to python's main?
if __name__ == "__main__":
tell_the_truth()
Is it to simply call the function inside the file?
tell_the_truth
I believe this will work:
if __FILE__ == $0
tell_the_truth()
end
if __FILE__ == $PROGRAM_NAME
tell_the_truth()
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With