{"id":6025,"date":"2022-12-20T18:57:51","date_gmt":"2022-12-20T21:57:51","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/if-mann\/"},"modified":"2022-12-20T18:57:51","modified_gmt":"2022-12-20T21:57:51","slug":"if-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/if-mann\/","title":{"rendered":"if (mann)"},"content":{"rendered":"<h1 align=\"center\">if<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">if \u2212 Execute scripts conditionally<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>if<\/b> <i>expr1<\/i> ?<b>then<\/b>? <i>body1<\/i> <b>elseif<\/b> <i>expr2<\/i> ?<b>then<\/b>? <i>body2<\/i> <b>elseif<\/b> &#8230; ?<b>else<\/b>? ?<i>bodyN<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>if<\/i> command evaluates <i>expr1<\/i> as an expression (in the same way that <b>expr<\/b> evaluates its argument). The value of the expression must be a boolean (a numeric value, where 0 is false and anything is true, or a string value such as <b>true<\/b> or <b>yes<\/b> for true and <b>false<\/b> or <b>no<\/b> for false); if it is true then <i>body1<\/i> is executed by passing it to the Tcl interpreter. Otherwise <i>expr2<\/i> is evaluated as an expression and if it is true then <b>body2<\/b> is executed, and so on. If none of the expressions evaluates to true then <i>bodyN<\/i> is executed. The <b>then<\/b> and <b>else<\/b> arguments are optional \u201cnoise words\u201d to make the command easier to read. There may be any number of <b>elseif<\/b> clauses, including zero. <i>BodyN<\/i> may also be omitted as long as <b>else<\/b> is omitted too. The return value from the command is the result of the body script that was executed, or an empty string if none of the expressions was non-zero and there was no <i>bodyN<\/i>.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">A simple conditional:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>if<\/b> {$vbl == 1} { puts &#8220;vbl is one&#8221; }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">With an <b>else<\/b>-clause:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>if<\/b> {$vbl == 1} { <br \/> puts &#8220;vbl is one&#8221; <br \/> } <b>else<\/b> { <br \/> puts &#8220;vbl is not one&#8221; <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">With an <b>elseif<\/b>-clause too:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>if<\/b> {$vbl == 1} { <br \/> puts &#8220;vbl is one&#8221; <br \/> } <b>elseif<\/b> {$vbl == 2} { <br \/> puts &#8220;vbl is two&#8221; <br \/> } <b>else<\/b> { <br \/> puts &#8220;vbl is not one or two&#8221; <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Remember, expressions can be multi-line, but in that case it can be a good idea to use the optional <b>then<\/b> keyword for clarity:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>if<\/b> { <br \/> $vbl == 1 <br \/> || $vbl == 2 <br \/> || $vbl == 3 <br \/> } <b>then<\/b> { <br \/> puts &#8220;vbl is one, two or three&#8221; <br \/> }<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">expr(n), for(n), foreach(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">boolean, conditional, else, false, if, true<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  if \u2212 Execute scripts conditionally <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3783,1],"tags":[2702,2635],"class_list":["post-6025","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-if","tag-mann"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6025","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6025"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6025\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}