{"id":6649,"date":"2026-04-13T11:50:51","date_gmt":"2026-04-13T11:50:51","guid":{"rendered":"http:\/\/the-codest.localhost\/dictionary\/routine-and-subroutine\/"},"modified":"2026-04-13T11:50:51","modified_gmt":"2026-04-13T11:50:51","slug":"adferd-og-undiradferd","status":"publish","type":"dictionary","link":"https:\/\/thecodest.co\/is\/dictionary\/routine-and-subroutine\/","title":{"rendered":"R\u00fat\u00edna og undirr\u00fat\u00edna"},"content":{"rendered":"<h1>R\u00fat\u00edna og undirr\u00fat\u00edna: skilgreining og helstu munir<\/h1>\n<p>Routine og subroutine eru tv\u00f6 grundvallaratri\u00f0i \u00ed forritun sem oft eru notu\u00f0 \u00ed sta\u00f0 hvor annars. Hins vegar eru \u00e1berandi munir \u00e1 \u00feeim sem a\u00f0greina \u00feau. \u00cd \u00feessari grein munum vi\u00f0 skilgreina routine og subroutine, varpa lj\u00f3si \u00e1 muninn \u00e1 \u00feeim og kanna mikilv\u00e6gi \u00feeirra \u00ed forritun.<\/p>\n<h3>Hva\u00f0 er r\u00fat\u00edna?<\/h3>\n<p>R\u00fat\u00edna er blokk af <a href=\"https:\/\/thecodest.co\/is\/dictionary\/what-is-code-refactoring\/\">k\u00f3\u00f0i<\/a> sem framkv\u00e6mir \u00e1kve\u00f0i\u00f0 verkefni e\u00f0a verkefnasett. \u00dea\u00f0 er sj\u00e1lfst\u00e6tt k\u00f3\u00f0aeining sem h\u00e6gt er a\u00f0 keyra m\u00f6rgum sinnum. Undirritur eru oft nota\u00f0ar til a\u00f0 brj\u00f3ta ni\u00f0ur st\u00f3r forrit \u00ed minni, au\u00f0veldari hluta. \u00de\u00e6r m\u00e1 kalla \u00far \u00f6\u00f0rum hlutum forritsins e\u00f0a keyra sj\u00e1lfst\u00e6tt.<\/p>\n<p>R\u00fat\u00ednur eru gjarnan nota\u00f0ar til a\u00f0 framkv\u00e6ma endurtekningarverkefni, svo sem inntaks- og \u00fattaks a\u00f0ger\u00f0ir, villume\u00f0fer\u00f0 og <a href=\"https:\/\/thecodest.co\/is\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">g\u00f6gn<\/a> sta\u00f0festing. \u00de\u00e6r geta einnig veri\u00f0 nota\u00f0ar til a\u00f0 fela fl\u00f3kin reiknirit e\u00f0a vi\u00f0skiptal\u00f3g\u00edk. Undirritunar geta veri\u00f0 skrifa\u00f0ar \u00ed hva\u00f0a forritunarm\u00e1li sem er og geta veri\u00f0 nota\u00f0ar \u00ed hva\u00f0a tegund forrits sem er, allt fr\u00e1 skj\u00e1bor\u00f0sforritum til <a href=\"https:\/\/thecodest.co\/is\/blog\/find-your-ideal-stack-for-web-development\/\">vefur<\/a> forrit.<\/p>\n<h3>Hva\u00f0 er undirr\u00fat\u00edna?<\/h3>\n<p>Undirferill er tegund ferils sem er hanna\u00f0ur til a\u00f0 framkv\u00e6ma \u00e1kve\u00f0i\u00f0 verkefni og skila gildi til kallandi forrits. Undirferlar eru einnig kalla\u00f0ir fall, a\u00f0fer\u00f0ir e\u00f0a verklagsreglur. \u00deeir eru nota\u00f0ir til a\u00f0 brj\u00f3ta ni\u00f0ur fl\u00f3kin forrit \u00ed minni, au\u00f0veldari einingar sem h\u00e6gt er a\u00f0 endurnota \u00ed \u00f6\u00f0rum hlutum forritsins.<\/p>\n<p>Undirferlar eru oft nota\u00f0ir til a\u00f0 framkv\u00e6ma \u00fatreikninga, vinna \u00far g\u00f6gnum e\u00f0a sinna \u00f6\u00f0rum verkefnum sem krefjast tiltekins setts fyrirm\u00e6la. \u00deeir geta veri\u00f0 kalla\u00f0ir \u00far \u00f6\u00f0rum hlutum forritsins e\u00f0a keyr\u00f0ir sj\u00e1lfst\u00e6tt. Undirferla m\u00e1 skrifa \u00e1 hva\u00f0a forritunarm\u00e1li sem er og nota \u00ed hva\u00f0a tegund forrits sem er, allt fr\u00e1 skj\u00e1bor\u00f0sforritum til vefforrita.<\/p>\n<h3>Helstu munurinn \u00e1 r\u00fat\u00ednu og undirr\u00fat\u00ednu<\/h3>\n<p>\u00de\u00f3 a\u00f0 a\u00f0fer\u00f0ir og undira\u00f0fer\u00f0ir s\u00e9u svipa\u00f0ar \u00e1 marga vegu, eru nokkur lykilatri\u00f0i sem a\u00f0greina \u00fe\u00e6r:<\/p>\n<ul>\n<li><strong>Tilgangur:<\/strong> R\u00fat\u00ednur eru hanna\u00f0ar til a\u00f0 framkv\u00e6ma tilteki\u00f0 verkefni e\u00f0a verkefnasett, en undirr\u00fat\u00ednur eru hanna\u00f0ar til a\u00f0 framkv\u00e6ma tilteki\u00f0 verkefni og skila gildi til kallandi forritsins.<\/li>\n<li><strong>St\u00fdring:<\/strong> R\u00fat\u00ednur m\u00e1 kalla \u00far \u00f6\u00f0rum hlutum forritsins e\u00f0a l\u00e1ta ganga sj\u00e1lfst\u00e6tt, en undirr\u00fat\u00ednur ver\u00f0a a\u00f0 vera kalla\u00f0ar \u00far \u00f6\u00f0rum hlutum forritsins.<\/li>\n<li><strong>Endurnotkun:<\/strong> R\u00fat\u00ednur er h\u00e6gt a\u00f0 endurn\u00fdta \u00ed \u00f6\u00f0rum hlutum forritsins, en undirr\u00fat\u00ednur eru hanna\u00f0ar til a\u00f0 vera endurn\u00fdttar \u00ed \u00f6\u00f0rum hlutum forritsins.<\/li>\n<li><strong>Fl\u00e6kjustig:<\/strong> Undirferlar eru oft nota\u00f0ir til a\u00f0 brj\u00f3ta ni\u00f0ur fl\u00f3kin forrit \u00ed minni, au\u00f0veldari hluta, en ferlar eru nota\u00f0ir til a\u00f0 framkv\u00e6ma endurteknar a\u00f0ger\u00f0ir e\u00f0a fela \u00ed s\u00e9r fl\u00f3kin reiknirit e\u00f0a vi\u00f0skiptal\u00f3g\u00edk.<\/li>\n<\/ul>\n<h3>Mikilv\u00e6gi \u00ed forritun<\/h3>\n<p>R\u00fat\u00ednur og undirr\u00fat\u00ednur eru grundvallaratri\u00f0i \u00ed forritun sem eru notu\u00f0 \u00ed n\u00e1nast \u00f6llum forritum. \u00de\u00e6r gera forriturum kleift a\u00f0 brj\u00f3ta st\u00f3r forrit ni\u00f0ur \u00ed minni, au\u00f0veldari einingar, sem au\u00f0veldar ritun, pr\u00f3fun og vi\u00f0hald k\u00f3\u00f0a. \u00de\u00e6r stu\u00f0la einnig a\u00f0 endurn\u00fdtingu k\u00f3\u00f0a, sem getur spara\u00f0 t\u00edma og b\u00e6tt heildarg\u00e6\u00f0i k\u00f3\u00f0ans.<\/p>\n<p>B\u00e6\u00f0i a\u00f0fer\u00f0ir og undir\u00e1\u00f0ger\u00f0ir m\u00e1 nota til a\u00f0 b\u00e6ta frammist\u00f6\u00f0u forrits me\u00f0 \u00fev\u00ed a\u00f0 draga \u00far magni k\u00f3\u00f0ans sem \u00fearf a\u00f0 keyrast. \u00de\u00e6r m\u00e1 einnig nota til a\u00f0 b\u00e6ta l\u00e6sileika k\u00f3\u00f0ans me\u00f0 \u00fev\u00ed a\u00f0 gera hann au\u00f0skiljanlegri og au\u00f0veldara a\u00f0 fylgja.<\/p>\n<p>A\u00f0 lokum eru r\u00fat\u00ednur og undirr\u00fat\u00ednur grundvallaratri\u00f0i \u00ed forritun sem allir forritarar \u00e6ttu a\u00f0 skilja. Me\u00f0 \u00fev\u00ed a\u00f0 nota \u00fe\u00e6r \u00e1 skilvirkan h\u00e1tt geta forritarar skrifa\u00f0 betri k\u00f3\u00f0a, spara\u00f0 t\u00edma og b\u00e6tt heildarg\u00e6\u00f0i forrita sinna.<\/p>","protected":false},"excerpt":{"rendered":"<p>L\u00e6r\u00f0u muninn \u00e1 r\u00fat\u00ednu og undirr\u00fat\u00ednu \u00ed forritun. Uppg\u00f6tva\u00f0u mikilv\u00e6gi \u00feeirra og helstu mismun \u00ed \u00feessari yfirgripsmiklu grein.<\/p>","protected":false},"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"class_list":["post-6649","dictionary","type-dictionary","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Routine And Subroutine - The Codest<\/title>\n<meta name=\"description\" content=\"Learn the difference between routine and subroutine in programming. Discover their significance and key differences in this comprehensive article.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/is\/ordabok\/adferd-og-undiradferd\/\" \/>\n<meta property=\"og:locale\" content=\"is_IS\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Routine And Subroutine\" \/>\n<meta property=\"og:description\" content=\"Learn the difference between routine and subroutine in programming. Discover their significance and key differences in this comprehensive article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/is\/ordabok\/adferd-og-undiradferd\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/06\/cover-image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/dictionary\\\/routine-and-subroutine\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/dictionary\\\/routine-and-subroutine\\\/\",\"name\":\"Routine And Subroutine - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"datePublished\":\"2026-04-13T11:50:51+00:00\",\"description\":\"Learn the difference between routine and subroutine in programming. Discover their significance and key differences in this comprehensive article.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/dictionary\\\/routine-and-subroutine\\\/#breadcrumb\"},\"inLanguage\":\"is\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/dictionary\\\/routine-and-subroutine\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/dictionary\\\/routine-and-subroutine\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Dictionary\",\"item\":\"https:\\\/\\\/thecodest.co\\\/sv\\\/ordbok\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Routine And Subroutine\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"is\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"is\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"R\u00fat\u00edna og undirr\u00fat\u00edna - The Codest","description":"L\u00e6r\u00f0u muninn \u00e1 r\u00fat\u00ednu og undirr\u00fat\u00ednu \u00ed forritun. Uppg\u00f6tva\u00f0u mikilv\u00e6gi \u00feeirra og helstu mismun \u00ed \u00feessari yfirgripsmiklu grein.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thecodest.co\/is\/ordabok\/adferd-og-undiradferd\/","og_locale":"is_IS","og_type":"article","og_title":"Routine And Subroutine","og_description":"Learn the difference between routine and subroutine in programming. Discover their significance and key differences in this comprehensive article.","og_url":"https:\/\/thecodest.co\/is\/ordabok\/adferd-og-undiradferd\/","og_site_name":"The Codest","og_image":[{"width":1200,"height":675,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/06\/cover-image.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/thecodest.co\/dictionary\/routine-and-subroutine\/","url":"https:\/\/thecodest.co\/dictionary\/routine-and-subroutine\/","name":"R\u00fat\u00edna og undirr\u00fat\u00edna - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"datePublished":"2026-04-13T11:50:51+00:00","description":"L\u00e6r\u00f0u muninn \u00e1 r\u00fat\u00ednu og undirr\u00fat\u00ednu \u00ed forritun. Uppg\u00f6tva\u00f0u mikilv\u00e6gi \u00feeirra og helstu mismun \u00ed \u00feessari yfirgripsmiklu grein.","breadcrumb":{"@id":"https:\/\/thecodest.co\/dictionary\/routine-and-subroutine\/#breadcrumb"},"inLanguage":"is","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/dictionary\/routine-and-subroutine\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/dictionary\/routine-and-subroutine\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Dictionary","item":"https:\/\/thecodest.co\/sv\/ordbok\/"},{"@type":"ListItem","position":3,"name":"Routine And Subroutine"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"is"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"is","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/dictionary\/6649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/dictionary"}],"about":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/types\/dictionary"}],"version-history":[{"count":1,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/dictionary\/6649\/revisions"}],"predecessor-version":[{"id":10964,"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/dictionary\/6649\/revisions\/10964"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/is\/wp-json\/wp\/v2\/media?parent=6649"}],"curies":[{"name":"vp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}