{"id":155,"date":"2019-09-24T07:55:55","date_gmt":"2019-09-24T07:55:55","guid":{"rendered":"http:\/\/sumitjangid.com\/?p=155"},"modified":"2019-09-24T08:03:46","modified_gmt":"2019-09-24T08:03:46","slug":"continue","status":"publish","type":"post","link":"http:\/\/sumitjangid.com\/index.php\/2019\/09\/24\/continue\/","title":{"rendered":"Continue"},"content":{"rendered":"\n<p>The&nbsp;<code>CONTINUE<\/code>&nbsp;statement stops the current iteration of the loop and starts the new one. The following illustrates the syntax of the&nbsp;<code>CONTINUE<\/code>&nbsp;statement:<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1234567<\/td><td>WHILE Boolean_expressionBEGIN&nbsp;&nbsp;&nbsp;&nbsp;<em>&#8212; code to be executed<\/em>&nbsp;&nbsp;&nbsp;&nbsp;IF condition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CONTINUE;&nbsp;&nbsp;&nbsp;&nbsp;<em>&#8212; code will be skipped if the condition is met<\/em>END<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>In this syntax, the current iteration of the loop is stopped once the condition evaluates to&nbsp;<code>TRUE<\/code>. The next iteration of the loop will continue until the&nbsp;<code>Boolean_expression<\/code>&nbsp;evaluates to&nbsp;<code>FALSE<\/code>.<\/p>\n\n\n\n<p>Similar to the&nbsp;<code>BREAK<\/code>&nbsp;statement, the&nbsp;<code>CONTINUE<\/code>&nbsp;statement is often used in conjunction with an&nbsp;<code>IF...ELSE<\/code>&nbsp;statement. Note that this is not mandatory though.<\/p>\n\n\n\n<h2>SQL Server&nbsp;<code>CONTINUE<\/code>&nbsp;example<\/h2>\n\n\n\n<p>The following example illustrates how the&nbsp;<code>CONTINUE<\/code>&nbsp;statement works.<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>123456789<\/td><td>DECLARE @counter INT = 0;&nbsp;WHILE @counter &lt; 5BEGIN&nbsp;&nbsp;&nbsp;&nbsp;SET @counter = @counter + 1;&nbsp;&nbsp;&nbsp;&nbsp;IF @counter = 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CONTINUE; &nbsp;&nbsp;&nbsp;&nbsp;PRINT @counter;END<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Here is the output:<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>1234<\/td><td>1245<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>In this example:<\/p>\n\n\n\n<p>First, we&nbsp;<a href=\"http:\/\/www.sqlservertutorial.net\/sql-server-stored-procedures\/variables\/\">declared a variable<\/a>&nbsp;named&nbsp;<code>@counter<\/code>&nbsp;and set its value to zero.<\/p>\n\n\n\n<p>Then, the&nbsp;<code><a href=\"http:\/\/www.sqlservertutorial.net\/sql-server-stored-procedures\/sql-server-while\/\">WHILE<\/a><\/code>&nbsp;loop started. Inside the&nbsp;<code>WHILE<\/code>&nbsp;loop, we increased the counter by one in each iteration. If the&nbsp;<code>@counter<\/code>&nbsp;was three, we skipped printing out the value using the&nbsp;<code>CONTINUE<\/code>&nbsp;statement. That\u2019s why in the output, you do not see the number three is showing up.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;CONTINUE&nbsp;statement stops the current iteration of the loop and starts the new one. The following illustrates the syntax of the&nbsp;CONTINUE&nbsp;statement: 1234567 WHILE Boolean_expressionBEGIN&nbsp;&nbsp;&nbsp;&nbsp;&#8212; code to be executed&nbsp;&nbsp;&nbsp;&nbsp;IF condition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CONTINUE;&nbsp;&nbsp;&nbsp;&nbsp;&#8212; code will be skipped if the condition&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,18,19],"tags":[],"_links":{"self":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/155"}],"collection":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/comments?post=155"}],"version-history":[{"count":1,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/155\/revisions"}],"predecessor-version":[{"id":156,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/155\/revisions\/156"}],"wp:attachment":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/media?parent=155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/categories?post=155"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/tags?post=155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}