<html lang="en"> <head> <title>Exclamation mark as not operator - Frequently asked questions about Octave (with answers)</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="Frequently asked questions about Octave (with answers)"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Octave-Features.html#Octave-Features" title="Octave Features"> <link rel="prev" href="Coherent-syntax.html#Coherent-syntax" title="Coherent syntax"> <link rel="next" href="Increment-and-decrement-operators.html#Increment-and-decrement-operators" title="Increment and decrement operators"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Exclamation-mark-as-not-operator"></a> <p> Next: <a rel="next" accesskey="n" href="Increment-and-decrement-operators.html#Increment-and-decrement-operators">Increment and decrement operators</a>, Previous: <a rel="previous" accesskey="p" href="Coherent-syntax.html#Coherent-syntax">Coherent syntax</a>, Up: <a rel="up" accesskey="u" href="Octave-Features.html#Octave-Features">Octave Features</a> <hr> </div> <h3 class="section">5.7 Exclamation mark as not operator</h3> <p>The exclamation mark ‘<samp><span class="samp">!</span></samp>’ (aka “Bang!”) is a negation operator, just like the tilde ‘<samp><span class="samp">~</span></samp>’: <pre class="example"> octave:1> if ! strcmp (program_name, "octave"), > "It's an error" > else > "It works!" > end ans = It works! </pre> <p class="noindent">Note however that <span class="sc">Matlab</span> uses the ‘<samp><span class="samp">!</span></samp>’ operator for shell escapes, for which Octave requires using the <code>system</code> command. </body></html>