{"id":2938,"date":"2015-11-20T14:33:02","date_gmt":"2015-11-20T13:33:02","guid":{"rendered":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/"},"modified":"2015-11-20T14:33:02","modified_gmt":"2015-11-20T13:33:02","slug":"sass-lesson-5-conditions-and-loops","status":"publish","type":"post","link":"https:\/\/www.ice-dev.com\/en\/html-css-js-integration\/sass-lesson-5-conditions-and-loops\/","title":{"rendered":"SASS &#8211; Lesson 5 : Conditions and Loops"},"content":{"rendered":"<h2>Conditions<\/h2>\n<p>With conditions, it&#8217;s possible to check certain information in our SCSS file. For example, if the color is equal to <b>orange<\/b>, then we define new parameters:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/e14756c0f125fd023731.js\"><\/script><\/p>\n<p>Generated CSS :<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/da9ba1594c9c96b31516.js\"><\/script><\/p>\n<p>Thanks to this condition, it&#8217;s possible to change the value of <b>$shadow<\/b> by setting <b>$color<\/b>. In this example, we check the value of <b>$color<\/b>, however, several other comparisons are possible. Discover all the <a href=\"http:\/\/sass-lang.com\/documentation\/file.SASS_REFERENCE.html#control_directives\" target=\"_blank\" rel=\"noopener\">control directives<\/a> of SASS.<\/p>\n<h2>Loops<\/h2>\n<p>Loops allow you to repeat an instruction as many times as you want.<\/p>\n<h3>Loops @for<\/h3>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/45fa0f2303eabe80de32.js\"><\/script><\/p>\n<p>Generated CSS :<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/75c0cea313bcc134b3b1.js\"><\/script><\/p>\n<h3>Loops @while<\/h3>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/a06bc62fcb4991362022.js\"><\/script><\/p>\n<p>Generated CSS :<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/cd1435c6a191e392b2c0.js\"><\/script><\/p>\n<h3>Loops @each<\/h3>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/11f84a9547d0db3cd69c.js\"><\/script><\/p>\n<p>Generated CSS :<\/p>\n<p><script src=\"https:\/\/gist.github.com\/reficedev\/e82a7527f949257fefa5.js\"><\/script><\/p>\n<p>This list can be defined in a variable (<a href=\"http:\/\/php.net\/manual\/fr\/function.array.php\" target=\"_blank\" rel=\"noopener\">comparable to arrays in PHP<\/a>). Each value must be separated by a comma.<br \/>\nExample: <strong>$var: puma, sea-slug, egret, salamander<\/strong>;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use loops and conditions for generating your style sheets with SASS.<\/p>\n","protected":false},"author":2,"featured_media":2030,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"kia_subtitle":"","footnotes":""},"categories":[51],"tags":[],"class_list":["post-2938","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html-css-js-integration"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SASS - Lesson 5 : Conditions and Loops - Ice Development<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SASS - Lesson 5 : Conditions and Loops - Ice Development\" \/>\n<meta property=\"og:description\" content=\"Use loops and conditions for generating your style sheets with SASS.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/\" \/>\n<meta property=\"og:site_name\" content=\"Ice Development\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ice.development\" \/>\n<meta property=\"article:published_time\" content=\"2015-11-20T13:33:02+00:00\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Richin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@icedevelopment\" \/>\n<meta name=\"twitter:site\" content=\"@icedevelopment\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Richin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/\"},\"author\":{\"name\":\"St\u00e9phane Richin\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/person\\\/285b738ea5332302231ff7e0db6becfe\"},\"headline\":\"SASS &#8211; Lesson 5 : Conditions and Loops\",\"datePublished\":\"2015-11-20T13:33:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/\"},\"wordCount\":127,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/conditions-boucles-sass.png\",\"articleSection\":[\"HTML\\\/CSS\\\/JS integration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/\",\"name\":\"SASS - Lesson 5 : Conditions and Loops - Ice Development\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/conditions-boucles-sass.png\",\"datePublished\":\"2015-11-20T13:33:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/conditions-boucles-sass.png\",\"contentUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2015\\\/11\\\/conditions-boucles-sass.png\",\"width\":248,\"height\":177},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/non-classifiee\\\/sass-lesson-5-conditions-and-loops\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.ice-dev.com\\\/en\\\/ice-development\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SASS &#8211; Lesson 5 : Conditions and Loops\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#website\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/\",\"name\":\"Ice Development\",\"description\":\"agence web Lyon\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.ice-dev.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#organization\",\"name\":\"Ice Development\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/apple-touch-2.png\",\"contentUrl\":\"https:\\\/\\\/www.ice-dev.com\\\/wp-content\\\/uploads\\\/2023\\\/06\\\/apple-touch-2.png\",\"width\":512,\"height\":512,\"caption\":\"Ice Development\"},\"image\":{\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/ice.development\",\"https:\\\/\\\/x.com\\\/icedevelopment\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/ice-development-lyon\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.ice-dev.com\\\/#\\\/schema\\\/person\\\/285b738ea5332302231ff7e0db6becfe\",\"name\":\"St\u00e9phane Richin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g\",\"caption\":\"St\u00e9phane Richin\"},\"url\":\"https:\\\/\\\/www.ice-dev.com\\\/en\\\/author\\\/stephane-richin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SASS - Lesson 5 : Conditions and Loops - Ice Development","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:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/","og_locale":"en_US","og_type":"article","og_title":"SASS - Lesson 5 : Conditions and Loops - Ice Development","og_description":"Use loops and conditions for generating your style sheets with SASS.","og_url":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/","og_site_name":"Ice Development","article_publisher":"https:\/\/www.facebook.com\/ice.development","article_published_time":"2015-11-20T13:33:02+00:00","author":"St\u00e9phane Richin","twitter_card":"summary_large_image","twitter_creator":"@icedevelopment","twitter_site":"@icedevelopment","twitter_misc":{"Written by":"St\u00e9phane Richin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#article","isPartOf":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/"},"author":{"name":"St\u00e9phane Richin","@id":"https:\/\/www.ice-dev.com\/#\/schema\/person\/285b738ea5332302231ff7e0db6becfe"},"headline":"SASS &#8211; Lesson 5 : Conditions and Loops","datePublished":"2015-11-20T13:33:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/"},"wordCount":127,"commentCount":0,"publisher":{"@id":"https:\/\/www.ice-dev.com\/#organization"},"image":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/conditions-boucles-sass.png","articleSection":["HTML\/CSS\/JS integration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/","url":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/","name":"SASS - Lesson 5 : Conditions and Loops - Ice Development","isPartOf":{"@id":"https:\/\/www.ice-dev.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#primaryimage"},"image":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#primaryimage"},"thumbnailUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/conditions-boucles-sass.png","datePublished":"2015-11-20T13:33:02+00:00","breadcrumb":{"@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#primaryimage","url":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/conditions-boucles-sass.png","contentUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2015\/11\/conditions-boucles-sass.png","width":248,"height":177},{"@type":"BreadcrumbList","@id":"https:\/\/www.ice-dev.com\/non-classifiee\/sass-lesson-5-conditions-and-loops\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.ice-dev.com\/en\/ice-development\/"},{"@type":"ListItem","position":2,"name":"SASS &#8211; Lesson 5 : Conditions and Loops"}]},{"@type":"WebSite","@id":"https:\/\/www.ice-dev.com\/#website","url":"https:\/\/www.ice-dev.com\/","name":"Ice Development","description":"agence web Lyon","publisher":{"@id":"https:\/\/www.ice-dev.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.ice-dev.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.ice-dev.com\/#organization","name":"Ice Development","url":"https:\/\/www.ice-dev.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ice-dev.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2023\/06\/apple-touch-2.png","contentUrl":"https:\/\/www.ice-dev.com\/wp-content\/uploads\/2023\/06\/apple-touch-2.png","width":512,"height":512,"caption":"Ice Development"},"image":{"@id":"https:\/\/www.ice-dev.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ice.development","https:\/\/x.com\/icedevelopment","https:\/\/www.linkedin.com\/company\/ice-development-lyon\/"]},{"@type":"Person","@id":"https:\/\/www.ice-dev.com\/#\/schema\/person\/285b738ea5332302231ff7e0db6becfe","name":"St\u00e9phane Richin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8c4ea36b3675b71044b8d272dafb85a97ba58bd729d9e61482a3a794cc603505?s=96&d=mm&r=g","caption":"St\u00e9phane Richin"},"url":"https:\/\/www.ice-dev.com\/en\/author\/stephane-richin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/posts\/2938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/comments?post=2938"}],"version-history":[{"count":0,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/posts\/2938\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/media\/2030"}],"wp:attachment":[{"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/media?parent=2938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/categories?post=2938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ice-dev.com\/en\/wp-json\/wp\/v2\/tags?post=2938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}