{"identifier":45460,"topic":"Commands","name":"put","text":"<code><pre>put <i>expression<\/i>\nput <i>expression<\/i> <i>preposition<\/i> \u00ac\n    <\/pre><\/code>[<i><code>chunk<\/i> of<\/pre><\/code>]<code> <i>container<\/i> <br><br>\n\n put <i>menuItemList<\/i> <i>preposition<\/i> \u00ac     <\/code>[<i><code>menuItem<\/i> of<\/code>]<code> <i>menu<\/i> \u00ac     <\/code>[<code>with menuMessages <i>messageList<\/i><\/code> ] <br><br>\n\n The<code> put <\/code>command evaluates an expression and places the value it extracts<code> into<\/code>,<code> after<\/code>, or<code> before <\/code>the contents of a container. <br>\n<br>\nThe container can be a button, a field, a variable, the Message box, the selection, a <i><code>chunk<\/i><\/code> expression, or a menu. If you don\u2019t specify a container, HyperCard puts the value into the Message box, showing it if it\u2019s hidden. <br><br>\n\n Use<code> put <\/code>with<code> into <\/code>to replace the contents of a container or menu, with<code> before <\/code>to place the value at the beginning of its contents, and with<code> after <\/code>to append the value to the end of its contents. <br>\n","related":{"24266":null,"27092":null,"34927":null,"34045":"create","34478":"delete","38686":"get","47503":"set"},"examples":"-- These are equivalent:\nput 42.5 * 675\nput 42.5 * 675 into msg\nput 42.5 * 675 into the Message box \n\nput empty into It  \n\nput \"Hello\" into field 1  \nput \"Go: \" before field \"WhereTo\"  \nput \".\" after last character of last word of field 3  \nput the date into varName\nput the clickLine into theLineClicked\nput the value of the clickLine into theTextClicked\nput \"*\" after the selection\n\n-- Add items to a menu:\ncreate menu \"Example\"\nput \"1,2,3,-,4,5,6\" into menu \"Example\"\nput \"7\" after menu \"Example\" with menuMessage \"beep\"\nput \"a,b,c,-\" before menu \"example\" \u00ac\n    with menuMessages \"beep,beep 2,beep 3,empty\"\n\n-- add items to a button\nput \"Boston\" & return & \"New York\" & return & \"Salem\" into button \"Maps\"","demo":"on putDemo\n   get bkgndFields()\n   if the number of chars of it < 255 then answer it\n end putDemo\n <br><br>\n\n function bkgndFields\n   -- Returns a return-delimited list of the bg fields\n   repeat with i = 1 to the number of bkgnd fields\n     <b>put<\/b> the short name of bg field i & return <b>after<\/b> theFields\n   end repeat\n   return theFields\n end bkgndFields\n ","debug":{"9":["put expression\rput e"],"10":["The container can be"]}}