Exit main

is there an exit function like exit(0)?
5 Replies
Jack Clayton
Jack Clayton15mo 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
Igor15mo 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 Clayton15mo ago
Oh yes great idea thanks @Igor, fyi @roopesh puthalath
roopesh puthalath
roopesh puthalathOP15mo ago
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
roopesh puthalathOP15mo ago
Thank you @Igor _ = exit(0)
Want results from more Discord servers?
Add your server