How to create an exit message

前端 未结 4 1827
刺人心
刺人心 2020-12-12 13:14

Is there a one line function call that quits the program and displays a message? I know in Perl it\'s as simple as:

die(\"Message goes here\")
4条回答
  •  盖世英雄少女心
    2020-12-12 13:59

    The abort function does this. For example:

    abort("Message goes here")
    

    Note: the abort message will be written to STDERR as opposed to puts which will write to STDOUT.

提交回复
热议问题