{"id":13427,"date":"2020-03-17T15:48:04","date_gmt":"2020-03-17T22:48:04","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=13427"},"modified":"2023-12-01T02:32:47","modified_gmt":"2023-12-01T10:32:47","slug":"java-for-each-loops","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/","title":{"rendered":"How to Use for and for each Loops in Java"},"content":{"rendered":"\n<p>Loops in programming are used to automate similar tasks that will be repeated multiple times. For instance, if you\u2019re creating a program that merges together the price and name of all lunchtime menu items for a restaurant, you may want to use a loop to automate the task.<br><\/p>\n\n\n\n<p>In Java, <code>for<\/code> loops are used to repeat the execution of a block of code a certain number of times. Whereas <code>while<\/code> loops run until a condition evaluates to false, <code>for<\/code> loops run for a certain number of iterations.<br><\/p>\n\n\n\n<p>This tutorial will discuss how to use <code>for<\/code> and <code>foreach<\/code> loops in Java, with reference to a few examples of <code>for<\/code> and <code>foreach<\/code> loops in Java programs.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">For Loop Java<\/h2>\n\n\n\n<p>Suppose you want to print the contents of an array that contains 100 items to the console. Or suppose you want to raise the price of everything in your store by 5 cents. Instead of doing these tasks manually, you would want to use a loop.<br><\/p>\n\n\n\n<p>In Java, <code>for<\/code> loops are used to run a specific task multiple times. Here\u2019s the syntax for a <code>for<\/code> loop in Java:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for (initialization; expression; updateCounter) {\n\t\/\/ Execute code\n}<\/pre><\/div>\n\n\n\n<p>Our loop has three components:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>initialization<\/strong> is the statement used to initialize a variable that keeps track of how many times the loop has executed.<\/li>\n\n\n\n<li><strong>expression<\/strong> is the condition the for loop will evaluate. This must be a boolean expression whose condition is true or false.<\/li>\n\n\n\n<li><strong>updateCounter<\/strong> is executed after the code block and updates the initialization variable.<\/li>\n<\/ul>\n\n\n\n<p>These components are all required.<br><\/p>\n\n\n\n<p>Let\u2019s walk through an example to illustrate how <code>for<\/code> loops work in Java. Suppose we are creating a program that allows a third-grader to find out the 10 times table. This program is used to help them revise for their upcoming math test.<br><\/p>\n\n\n\n<p>Instead of calculating 1 * 10, 2 * 10, etc. individually, we can instead use a \u201cfor\u201d loop to calculate each value in the 10 times table. Here\u2019s the code we would use to calculate all values from 1-10 in the 10 times table:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>public class TimesTable {\n\tpublic static void main(String[] args) {\n\t\tfor (int i = 1; i &lt;= 10; ++i) {\n\t\t\tint answer = i * 10;\n\t\t\tSystem.out.println(i + \" x 10 is \" + answer);\n\t\t}\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>1 x 10 is 10\n2 x 10 is 20\n3 x 10 is 30\n4 x 10 is 40\n5 x 10 is 50\n6 x 10 is 60\n7 x 10 is 70\n8 x 10 is 80\n9 x 10 is 90\n10 x 10 is 100<\/pre><\/div>\n\n\n\n<p>As you can see, our program has calculated all values in the 10 times table up to 10 * 10. Let\u2019s explore the code and discuss how it works step-by-step.<br><\/p>\n\n\n\n<p>First, we declare a class called TimesTable, which stores our code for this program. Then we create a <code>for<\/code> loop that executes the code within the loop 10 times over. Here are the three components of our <code>for<\/code> loop:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>int i = 1<\/code> tells our code to start counting from the value 1.<\/li>\n\n\n\n<li><code>i &lt;= 10<\/code> tells our code to execute the <code>for<\/code> loop only if the value in <code>i<\/code> is less than or equal to 10.<\/li>\n\n\n\n<li><code>++i<\/code> adds 1 to the <code>i<\/code> variable after the <code>for<\/code> loop has executed. This is called an increment counter.<\/li>\n<\/ul>\n\n\n\n<p>Then, we print out a statement with the math problem and its answer. This statement is formatted as <code>[i counter number] x 10 is<\/code>, followed by the answer to the problem.<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">For Each Loop Java<\/h2>\n\n\n\n<p>When you\u2019re working with an array and collection, there is another type of <code>for<\/code> loop you can use to iterate through the contents of the array or collection with which you are working. This is called a <code>for-each<\/code> loop, or an enhanced for loop.<br><\/p>\n\n\n\n<p>The syntax for the <code>for-each<\/code> loop is as follows:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>for (dataType item : collection) {\n\t\/\/ Execute code\n}<\/pre><\/div>\n\n\n\n<p>There are three components in our <code>for-each<\/code> loop:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>dataType<\/strong> is the type of data our item uses.<\/li>\n\n\n\n<li><strong>item<\/strong> is a single item in the collection.<\/li>\n\n\n\n<li><strong>collection<\/strong> is an array or collection variable through which the <code>for<\/code> loop will iterate.<\/li>\n<\/ul>\n\n\n\n<p>The <code>for-each<\/code> loop iterates through each item in the collection, stores each item in the <code>item<\/code> variable, then executes the code stored within the loop body. Let\u2019s walk through an example to discuss how this works.<br><\/p>\n\n\n\n<p>Suppose you are operating a coffee shop, and you want to reduce the price of every coffee by 25 cents for a flash-sale. You have a list that contains the prices of each coffee, and you want to subtract 25 cents from each price.<br><\/p>\n\n\n\n<p>You could do so using the following code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>public class ReducePrices {\n\tpublic static void main(String[] args) {\n\t\tdouble[] prices = {2.50, 2.75, 3.00, 2.75, 2.75, 2.30, 3.00, 2.60};\n\t\tfor (double i : prices) {\n\t\t\tdouble new_price = i - 0.25;\n\t\t\tSystem.out.println(\"The new price is \" + new_price);\n\t\t}\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>The new price is 2.25\nThe new price is 2.5\nThe new price is 2.75\nThe new price is 2.5\nThe new price is 2.5\nThe new price is 2.05\nThe new price is 2.75\nThe new price is 2.35<\/pre><\/div>\n\n\n\n<p>As you can see, our program has reduced the price of every coffee by 50 cents. Now we have the data we need to change our coffee prices for the flash sale.<br><\/p>\n\n\n\n<p>Let\u2019s walk through our code step-by-step. First, we declare a class called ReducePrices, which stores our code for this example. Then we declare an array called <code>prices<\/code> which stores the prices for our coffees. This array is declared as an array of doubles, or decimal-based numbers.<br><\/p>\n\n\n\n<p>Then we create a <code>foreach<\/code> loop that runs through each item in the <code>prices<\/code> array. For each item in the array, our program reduces the price of the coffee by 50 cents and assigns the reduced price to the variable <code>new_price<\/code>. Then, our program prints out \u201cThe new price is \u201c, followed by the new price of the coffee.<\/p>\n\n\n\n<iframe loading=\"lazy\" frameborder=\"0\" width=\"100%\" height=\"400px\" src=\"https:\/\/repl.it\/@careerkarma\/Java-For-Loop?lite=true\"><\/iframe>\n<br>\n<br>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The <code>for<\/code> loop is used in Java to execute a block of code a certain number of times. The <code>for-each<\/code> loop is used to run a block of code for each item held within an array or collection.<br><\/p>\n\n\n\n<p>In this tutorial, we explored how to use the <code>for<\/code> loop and the <code>for-each<\/code> loop in Java. We also referred to an example of each of these loops in action. We also discussed how each example worked step-by-step.<br><\/p>\n\n\n\n<p>You\u2019re now equipped with the knowledge you need to use Java <code>for<\/code> and <code>for-each<\/code> loops like a pro!<\/p>\n","protected":false},"excerpt":{"rendered":"Loops in programming are used to automate similar tasks that will be repeated multiple times. For instance, if you\u2019re creating a program that merges together the price and name of all lunchtime menu items for a restaurant, you may want to use a loop to automate the task. In Java, for loops are used to&hellip;","protected":false},"author":240,"featured_media":13431,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17289],"tags":[],"class_list":{"0":"post-13427","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-java"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Java","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Use for and for each Loops in Java | Career Karma<\/title>\n<meta name=\"description\" content=\"The for loop and for-each loops are used to automate similar tasks in a Java program. Learn how to use these Java loops in this 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:\/\/careerkarma.com\/blog\/java-for-each-loops\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use for and for each Loops in Java\" \/>\n<meta property=\"og:description\" content=\"The for loop and for-each loops are used to automate similar tasks in a Java program. Learn how to use these Java loops in this article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-17T22:48:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T10:32:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"667\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"How to Use for and for each Loops in Java\",\"datePublished\":\"2020-03-17T22:48:04+00:00\",\"dateModified\":\"2023-12-01T10:32:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/\"},\"wordCount\":862,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg\",\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/\",\"name\":\"How to Use for and for each Loops in Java | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg\",\"datePublished\":\"2020-03-17T22:48:04+00:00\",\"dateModified\":\"2023-12-01T10:32:47+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The for loop and for-each loops are used to automate similar tasks in a Java program. Learn how to use these Java loops in this article.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg\",\"width\":1000,\"height\":667},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\/\/careerkarma.com\/blog\/java\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Use for and for each Loops in Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Use for and for each Loops in Java | Career Karma","description":"The for loop and for-each loops are used to automate similar tasks in a Java program. Learn how to use these Java loops in this article.","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:\/\/careerkarma.com\/blog\/java-for-each-loops\/","og_locale":"en_US","og_type":"article","og_title":"How to Use for and for each Loops in Java","og_description":"The for loop and for-each loops are used to automate similar tasks in a Java program. Learn how to use these Java loops in this article.","og_url":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-03-17T22:48:04+00:00","article_modified_time":"2023-12-01T10:32:47+00:00","og_image":[{"width":1000,"height":667,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"How to Use for and for each Loops in Java","datePublished":"2020-03-17T22:48:04+00:00","dateModified":"2023-12-01T10:32:47+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/"},"wordCount":862,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg","articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/","url":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/","name":"How to Use for and for each Loops in Java | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg","datePublished":"2020-03-17T22:48:04+00:00","dateModified":"2023-12-01T10:32:47+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The for loop and for-each loops are used to automate similar tasks in a Java program. Learn how to use these Java loops in this article.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/java-for-each-loops\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/group-of-people-sitting-indoors-3184360.jpg","width":1000,"height":667},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/java-for-each-loops\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/careerkarma.com\/blog\/java\/"},{"@type":"ListItem","position":3,"name":"How to Use for and for each Loops in Java"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/13427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=13427"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/13427\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/13431"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=13427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=13427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=13427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}