Exit main

is there an exit function like exit(0)?
5 Replies
Jack Clayton
Jack Clayton2y ago
No not yet, Being a superset we'll have to support that eventually, but I don't believe it'll be a priority, please raise a feature request if you really want it: https://github.com/modularml/modular/issues/new/choose. EDIT: For now you can use external_call like @Igor points out below
Igor
Igor2y ago
You could use:
fn exit(status: Int32) -> UInt8:
return external_call["exit", UInt8, Int32](status)
fn exit(status: Int32) -> UInt8:
return external_call["exit", UInt8, Int32](status)
@Jack Clayton wouldn't that be better than calling Python?
Jack Clayton
Jack Clayton2y ago
Oh yes great idea thanks @Igor, fyi @roopesh puthalath
roopesh puthalath
Was building a small app that will do some computations , The idea was to call the exit button from some of the GUI buttons.
No description
roopesh puthalath
Thank you @Igor _ = exit(0)

Did you find this page helpful?