[{"data":1,"prerenderedAt":532},["ShallowReactive",2],{"/codetab":3,"/codetab-surround":521},{"id":4,"title":5,"body":6,"description":487,"extension":488,"meta":489,"navigation":507,"path":517,"seo":518,"stem":519,"__hash__":520},"content/codetab.md","Code Tab",{"type":7,"value":8,"toc":469},"minimark",[9,21,36,103,111,119,150,159,162,201,208,211,222,225,232,235,252,259,271,274,277,280,287,304,307,314,317,324,356,359,372,379,385,393,426,429,463],[10,11,15],"h1",{"id":12,"className":13},"code-tab",[14],"section-heading",[16,17,5],"a",{"className":18,"href":20},[19],"section-anchor","#code-tab",[22,23,24,25],"p",{},"The Code tab is where the code for the model is stored. Commands you only want\nto use once can be typed in the Command Center, but collections of commands that\nyou want to save for later use can be stored in the Code tab. ",[26,27],"img",{"alt":28,"className":29,"src":31,"width":32,"height":33,"style":34},"codetab/codetab.png",[30],"netlogo-image","/_content/images/codetab/codetab.png",690,541,{"aspectRatio":35},"690/541",[37,38,41,51],"div",{"className":39},[40],"toc",[42,43,46],"h4",{"id":44,"className":45},"table-of-contents",[14],[16,47,50],{"className":48,"href":49},[19],"#table-of-contents","Table of Contents",[52,53,54,61,67,73,79,85,91,97],"ul",{},[55,56,57],"li",{},[16,58,60],{"href":59},"#code-tab-toolbar","Code Tab Toolbar",[55,62,63],{},[16,64,66],{"href":65},"#checking-for-errors","Checking for Errors",[55,68,69],{},[16,70,72],{"href":71},"#separate-code-tab","Separate Code tab",[55,74,75],{},[16,76,78],{"href":77},"#find--replace","Find & Replace",[55,80,81],{},[16,82,84],{"href":83},"#automatic-indentation","Automatic Indentation",[55,86,87],{},[16,88,90],{"href":89},"#line-numbers","Line Numbers",[55,92,93],{},[16,94,96],{"href":95},"#more-editing-options","More Editing Options",[55,98,99],{},[16,100,102],{"href":101},"#included-files","Included Files",[104,105,108],"h2",{"id":106,"className":107},"code-tab-toolbar",[14],[16,109,60],{"className":110,"href":59},[19],[22,112,113],{},[26,114],{"src":115,"style":116,"width":117,"height":118},"/_content/images/codetab/codetabtoolbar.png","width:6in; aspect-ratio: 849/99;",849,99,[52,120,121,126,132,138,143],{},[55,122,123],{},[16,124,125],{"href":65},"Check",[55,127,128],{},[16,129,131],{"href":130},"#find-replace","Find",[55,133,134],{},[16,135,137],{"href":136},"#procedures-menu","Procedures",[55,139,140],{},[16,141,142],{"href":71},"Separate code window",[55,144,145,149],{},[16,146,148],{"href":147},"netlogopreferences#code-preferences","Preferences"," (also described in\nrelevant sections of this document)",[151,152,155],"h3",{"id":153,"className":154},"procedures-menu",[14],[16,156,158],{"className":157,"href":136},[19],"Procedures menu",[22,160,161],{},"This menu includes a list of all the procedures in the Code tab. Clicking on a\nprocedure moves the cursor to that procedure. Typing in the text box at the top\nwill filter the list, only showing procedures whose name contains the typed\ntext. By default procedures are listed alphabetically, but this can be changed\nto their order of appearance by using the “Sort order of procedures menu” code\npreference.",[37,163,166],{"className":164},[165],"table-container",[167,168,169,178],"table",{},[170,171,172,176],"colgroup",{},[173,174],"col",{"style":175},"width: 45%",[173,177],{"style":175},[179,180,181],"tbody",{},[182,183,184,185,194],"tr",{},"\n ",[186,187,188],"td",{},[26,189],{"src":190,"style":191,"width":192,"height":193},"/_content/images/codetab/codetabproceduresmenu.png","width:2in; aspect-ratio: 145/224;",145,224,[186,195,196],{},[26,197],{"src":198,"style":199,"width":192,"height":200},"/_content/images/codetab/codetabproceduresmenusearch.png","width:2in; aspect-ratio: 145/89;",89,[104,202,205],{"id":203,"className":204},"checking-for-errors",[14],[16,206,66],{"className":207,"href":65},[19],[22,209,210],{},"To determine if the code has any errors, you may press the “Check” button. If\nthere are any syntax errors, the Code tab will turn orange, the code that\ncontains the error will be highlighted, the cursor will move to the error\nlocation, and an error message will appear in an orange banner at the top of the\ncode area. If you don’t want the cursor to move when there is a compilation\nerror (for example when there is more code than fits on the screen) uncheck the\n“Auto-focus text or tab with errors when model is compiled” preference. The\nerror will not be highlighted. If the error occurs in the Interface tab, for\nexample if any button or plot commands result in a compilation error, the\nInterface tab will turn orange instead.",[22,212,213],{},[26,214],{"alt":215,"className":216,"src":217,"width":218,"height":219,"style":220},"codetab/codetaberror.png",[30],"/_content/images/codetab/codetaberror.png",549,306,{"aspectRatio":221},"549/306",[22,223,224],{},"Switching tabs also causes the code to be checked, so if you just switch tabs,\npressing the Check button first isn’t necessary.",[104,226,229],{"id":227,"className":228},"separate-code-tab",[14],[16,230,72],{"className":231,"href":71},[19],[22,233,234],{},"The Code tab can be opened in a separate window from the main NetLogo window. It\ncan then be moved and resized.",[52,236,237,240,243,246,249],{},[55,238,239],{},"The “Code Tab in separate window” checkbox can be used to switch the Code tab\nlocation between the main NetLogo window and a separate window.",[55,241,242],{},"A Control-click with the mouse on the tab bar of the Code tab will also switch\nits location.",[55,244,245],{},"To separate a Code tab from the main NetLogo window you can use Command +\nShift + W on Mac, Control + Shift + W on other operating systems.",[55,247,248],{},"To return a separated Code tab to the main NetLogo window you can use\nCommand + W on Mac, Control + W on other operating systems or click the\nwindow’s close button.",[55,250,251],{},"There is a Code preference to “Open code tab in separate window on startup”.",[104,253,256],{"id":254,"className":255},"find-replace",[14],[16,257,78],{"className":258,"href":77},[19],[22,260,261,262],{},"To find a fragment of code in the Code tab, click on the “Find” button in the\nCode toolbar and the Find dialog will appear. ",[26,263],{"alt":264,"className":265,"src":266,"width":267,"height":268,"style":269},"codetab/find-replace.png",[30],"/_content/images/codetab/find-replace.png",437,178,{"aspectRatio":270},"437/178",[22,272,273],{},"You may enter a word or phrase to find, and optionally also a new word or phrase\nto replace it with. The “Ignore case” checkbox controls whether the\ncapitalization must be the same to indicate a match.",[22,275,276],{},"If the “Wrap around” checkbox is checked, the entire Code tab will be checked\nfor the phrase, starting at the cursor position. When it reaches the end it will\nreturn to the top, otherwise only the area from the cursor position to the end\nof the Code tab will be searched. The “Next” and “Previous” buttons will move\ndown and up to find another occurrence of the search phrase.",[22,278,279],{},"“Replace” changes the currently selected phrase with the replace phrase and\n“Replace & Find” changes the selected phrase and moves to the next occurrence.\n“Replace All” will change all instances of the find phrase in the search area\nwith the replace phrase.",[104,281,284],{"id":282,"className":283},"automatic-indentation",[14],[16,285,84],{"className":286,"href":83},[19],[22,288,289,290,294,295],{},"When the “Auto indent” Code preference is selected, NetLogo will automatically\nattempt to align your code in a logically structured format. For example, when\nyou open a set of square brackets ”[” (perhaps after an ",[291,292,293],"code",{},"if"," statement), NetLogo\nwill automatically add spaces so that the following lines of code are two spaces\nfurther indented than the bracket. When you close the square brackets the\nclosing bracket will be lined up with the matching open bracket.\n",[26,296],{"alt":297,"className":298,"src":299,"width":300,"height":301,"style":302},"codetab/tabified-code.png",[30],"/_content/images/codetab/tabified-code.png",186,115,{"aspectRatio":303},"186/115",[22,305,306],{},"NetLogo will try to indent the code as you type, but you can also press the tab\nkey anywhere on any line to ask NetLogo to indent the line immediately. Or, you\ncan select a whole region of code and press the tab key to re-indent all of it.",[104,308,311],{"id":309,"className":310},"line-numbers",[14],[16,312,90],{"className":313,"href":89},[19],[22,315,316],{},"By default line numbers are shown on the left edge of the code area. They can be\nremoved by unselecting the “Show line numbers” Code preference.",[104,318,321],{"id":319,"className":320},"more-editing-options",[14],[16,322,96],{"className":323,"href":95},[19],[22,325,326,327,331,332,335,336,338,339,341,342,344,345,347,348,351,352,355],{},"To find a particular procedure definition in your code, use the “Procedures”\npopup menu in the Code tab. The menu lists all procedures in the order they\nappear in the file. To search for a particular procedure, use the search field\nat the top of the popup. It will filter the list of procedures using fuzzy\nmatching as you type. Fuzzy match will include procedures whose names contain\nthe characters that you type in the order that they appear in the search field,\nbut the characters do not have to be right next to each other. For instance,\n“fnn” will match”",[328,329,330],"strong",{},"f","ind-",[328,333,334],{},"n","earest-",[328,337,334],{},"eighbors” and\n“wol",[328,340,330],{},"-dow",[328,343,334],{},"-",[328,346,334],{},"eighbor” but not “nearest-wolf-neighbor”. You may use\nthe arrow keys or mouse to select a particular procedure and enter or click to\njump to it. This can be a very convenient way to navigate your file. To\nfacilitate this, you can use the shortcut ",[291,349,350],{},"ctrl-g"," (",[291,353,354],{},"cmd+g"," on Mac OS) to access\nthe procedures menu.",[22,357,358],{},"The “Shift Left”, “Shift Right”, “Comment”, and “Uncomment” items on the Edit\nmenu are used in the Code tab to change the indentation level of your code or\nadd and remove semicolons, which mark comments, from sections of code.",[22,360,361,362,366,367,371],{},"For more information about writing procedures, read\n",[16,363,365],{"href":364},"tutorial3","Tutorial #3: Procedures"," and the\n",[16,368,370],{"href":369},"/programming","Programming Guide",".",[104,373,376],{"id":374,"className":375},"included-files",[14],[16,377,102],{"className":378,"href":101},[19],[22,380,381,384],{},[328,382,383],{},"Caution:"," The includes facility is still experimental.",[22,386,387,388,392],{},"If you have a file with the extension .nls all of its breeds, variables, and\nprocedure definitions are available in the model if you add it by using the\n",[16,389,391],{"href":390},"dictionary#includes","__includes"," keyword to a model. When that keyword\nis used the “Included Files” appears menu to the right of the procedures menu\nappears. This menu lists all the NetLogo source files (.nls) included in this\nmodel. You can choose a file name from the menu to open a tab for that file, or\nyou can open a new or existing file using the “New Source File” or “Open Source\nFile” items .You can make this menu always visible using the “Always show\n“Included Files” menu” Code preference.",[37,394,396],{"className":395},[165],[167,397,398,404],{},[170,399,400,402],{},[173,401],{"style":175},[173,403],{"style":175},[179,405,406],{},[182,407,184,408,417],{},[186,409,410],{},[26,411],{"src":412,"width":413,"height":414,"style":415},"/_content/images/codetab/includesmenu.png",397,75,{"aspectRatio":416},"397/75",[186,418,419],{},[26,420],{"src":421,"width":422,"height":423,"style":424},"/_content/images/codetab/includesmenuopen.png",141,127,{"aspectRatio":425},"141/127",[22,427,428],{},"Once you’ve opened new tabs they become accessible from the Tabs menu, and you\ncan use the keyboard to move from tab to tab (Command + number on Mac, Control +\nnumber on other operating systems). If the main Code tab is in a separate\nwindow, the tabs for included files will appear there too. When an included\n(.nls) file tab is selected it becomes blue. An included file tab can be closed\nby clicking on the “x” on the right side of the tab. Each included file tab has\na toolbar indentical to the main Code Tab’s toolbar; the options in this toolbar\napply to all Code tabs, not just the one that is currently visible.",[37,430,432],{"className":431},[165],[167,433,434,442],{},[170,435,436,439],{},[173,437],{"style":438},"width: 35%",[173,440],{"style":441},"width: 55%",[179,443,444],{},[182,445,184,446,455],{},[186,447,448],{},[26,449],{"src":450,"width":451,"height":452,"style":453},"/_content/images/codetab/tabsmenu.png",333,153,{"aspectRatio":454},"333/153",[186,456,457],{},[26,458],{"src":459,"style":460,"width":461,"height":462},"/_content/images/codetab/codetabtoolbarwithnls.png","width:7in; aspect-ratio: 1052/128;",1052,128,[22,464,465,466,468],{},"Note that you can create or open an .nls file before including it in a model\nwith an ",[291,467,391],{}," statement. In this case, the contents of the file will not\nbe compilable, which is indicated by a warning label below the toolbar and by\nthe Check button being disabled. This does not affect the rest of the model or\ncause any errors, but the contents of the file will not be accessible from any\nother code tabs in the model.",{"title":470,"searchDepth":471,"depth":472,"links":473},"",5,3,[474,476,480,481,482,483,484,485,486],{"id":44,"depth":475,"text":50},4,{"id":106,"depth":477,"text":60,"children":478},2,[479],{"id":153,"depth":472,"text":158},{"id":203,"depth":477,"text":66},{"id":227,"depth":477,"text":72},{"id":254,"depth":477,"text":78},{"id":282,"depth":477,"text":84},{"id":309,"depth":477,"text":90},{"id":319,"depth":477,"text":96},{"id":374,"depth":477,"text":102},"The Code tab is where the code for the model is stored and where you can edit and manage your NetLogo programs.","md",{"source":490,"metadataOutputPath":491,"projectConfig":492,"language":499,"inheritFrom":508,"output":507,"version":493,"keywords":509,"tags":513,"icon":515,"assetsRoot":516},"autogen/codetab.md","content/codetab.metadata.yaml",{"version":493,"projectRoot":371,"scanRoot":494,"outputRoot":495,"defaults":496,"engine":502,"partials":503,"dedupeIdenticalDiskWrites":507},"7.0.4","autogen","content",{"inheritFrom":497,"language":499,"output":500,"extension":488,"title":501,"version":493},[498],0,"en",false,"NetLogo User Manual","handlebars",{"directoryPaths":504,"extensions":505},[371],[506,488],"mustache",true,[498],[5,510,511,512],"Programming","Code Editor","NetLogo",[5,510,514],"Editor","i-lucide-file-code","/home/runner/work/Helio/Helio/apps/docs/autogen","/codetab",{"title":5,"description":487},"codetab","9p4hfI0d07hHmjfpY799Gw3XtPZZ8LTJgCoLteIs13w",[522,527],{"title":523,"path":524,"stem":525,"description":526},"Bitmap Extension Dictionary: width","/bitmap/width","bitmap/width","Documentation for the width primitive.",{"title":528,"path":529,"stem":530,"description":531},"Color Picker","/colorpicker","colorpicker","The Color Picker allows you to select and customize colors for your NetLogo model interface elements and agents.",1777657788702]