{"id":6146,"date":"2022-12-20T18:57:58","date_gmt":"2022-12-20T21:57:58","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/lassign-mann\/"},"modified":"2022-12-20T18:57:58","modified_gmt":"2022-12-20T21:57:58","slug":"lassign-mann","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/lassign-mann\/","title":{"rendered":"lassign (mann)"},"content":{"rendered":"<h1 align=\"center\">lassign<\/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\">lassign \u2212 Assign list elements to variables<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>lassign<\/b> <i>list<\/i> ?<i>varName &#8230;<\/i>? ______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This command treats the value <i>list<\/i> as a list and assigns successive elements from that list to the variables given by the <i>varName<\/i> arguments in order. If there are more variable names than list elements, the remaining variables are set to the empty string. If there are more list elements than variables, a list of unassigned elements is returned.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">An illustration of how multiple assignment works, and what happens when there are either too few or too many elements.<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>lassign<\/b> {a b c} x y z ;# Empty return <br \/> puts $x ;# Prints &#8220;a&#8221; <br \/> puts $y ;# Prints &#8220;b&#8221; <br \/> puts $z ;# Prints &#8220;c&#8221;<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>lassign<\/b> {d e} x y z ;# Empty return <br \/> puts $x ;# Prints &#8220;d&#8221; <br \/> puts $y ;# Prints &#8220;e&#8221; <br \/> puts $z ;# Prints &#8220;&#8221;<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\"><b>lassign<\/b> {f g h i} x y ;# Returns &#8220;h i&#8221; <br \/> puts $x ;# Prints &#8220;f&#8221; <br \/> puts $y ;# Prints &#8220;g&#8221;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>lassign<\/b> command has other uses. It can be used to create the analogue of the \u201cshift\u201d command in many shell languages like this:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">set ::argv [<b>lassign<\/b> $::argv argumentToReadOff]<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">lindex(n), list(n), lrange(n), lset(n), set(n)<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">assign, element, list, multiple, set, variable<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  lassign \u2212 Assign list elements to variables <\/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":[2801,2635],"class_list":["post-6146","post","type-post","status-publish","format-standard","hentry","category-n-comandos-tcl-tk","category-sin-categoria","tag-lassign","tag-mann"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6146","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=6146"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6146\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}