[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"academy-blogs-en-1-1-all-enhance-your-program-intelligence-with-if-else-all--*":3,"academy-blog-translations-y2mcgmjwrp345w1":79},{"data":4,"page":67,"perPage":67,"totalItems":67,"totalPages":67},[5],{"alt":6,"collectionId":7,"collectionName":8,"content":9,"cover_image":10,"cover_image_path":11,"created":12,"created_by":13,"expand":14,"id":74,"keywords":75,"locale":49,"published_at":76,"scheduled_at":13,"school_blog":71,"short_description":77,"status":69,"title":6,"updated":78,"updated_by":13,"slug":72,"views":73},"EP.3 Enhance Your Program's Intelligence with If-Else in Go","sclblg987654321","school_blog_translations","\u003Cp>\u003Cspan style=\"font-size:20px;\">\u003Cstrong>Enhance Your Program's Intelligence with If-Else in Go\u003C\u002Fstrong>\u003C\u002Fspan>\u003C\u002Fp>\u003Cp>Have you ever wondered how programs make decisions? For instance, if the data is correct, they proceed; if not, they send an alert. This is the role of If-Else, which helps programs make intelligent decisions.\u003C\u002Fp>\u003Cp>What is If-Else? In every program, we need decision-making. For example, if the user enters the correct information, they can log in; if it's incorrect, an error notification is displayed. Using If-Else allows the program to function based on conditions.\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"language-plaintext\">package main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n    age := 20\r\n    if age &gt;= 18 {\r\n        fmt.Println(\"You are an adult.\")\r\n    } else {\r\n        fmt.Println(\"You are not an adult.\")\r\n    }\r\n}\r\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>\u003Cspan style=\"font-size:18px;\">\u003Cstrong>Structure of If-Else in Go\u003C\u002Fstrong>\u003C\u002Fspan>\u003C\u002Fp>\u003Cul style=\"list-style-type:circle;\">\u003Cli>if condition {}: If the condition is true, this block will execute.\u003C\u002Fli>\u003Cli>else {}: If the condition is false, this block will execute.\u003C\u002Fli>\u003C\u002Ful>\u003Cp>You can add multiple conditions using else if, for example:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"language-plaintext\">score := 85\r\nif score &gt;= 90 {\r\n    fmt.Println(\"Grade A\")\r\n} else if score &gt;= 80 {\r\n    fmt.Println(\"Grade B\")\r\n} else {\r\n    fmt.Println(\"Grade C\")\r\n}\r\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>&nbsp;\u003C\u002Fp>\u003Cp>\u003Cstrong>Using Comparison Operators\u003C\u002Fstrong>\u003Cbr>When writing conditions in If-Else, we use comparison operators such as:\u003C\u002Fp>\u003Cul>\u003Cli>== equals\u003C\u002Fli>\u003Cli>!= not equals\u003C\u002Fli>\u003Cli>&gt; greater than\u003C\u002Fli>\u003Cli>&lt; less than\u003C\u002Fli>\u003Cli>&gt;= greater than or equal to\u003C\u002Fli>\u003Cli>&lt;= less than or equal to\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Example:\u003C\u002Fp>\u003Cpre>\u003Ccode class=\"language-plaintext\">number := 10\r\nif number % 2 == 0 {\r\n    fmt.Println(\"Even number\")\r\n} else {\r\n    fmt.Println(\"Odd number\")\r\n}\r\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>All of this will help learners understand how to control program execution with If-Else, which is a fundamental aspect of creating smarter programs.\u003C\u002Fp>","5_11zon_6e70dtoh97.webp","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclblg987654321\u002Fyk2ce2j4f5epk77\u002F5_11zon_6e70dtoh97.webp","2026-03-04 08:51:56.184Z","",{"keywords":15,"locale":43,"school_blog":53},[16,23,28,33,38],{"collectionId":17,"collectionName":18,"created":19,"created_by":13,"id":20,"name":21,"updated":22,"updated_by":13},"sclkey987654321","school_keywords","2026-03-04 08:34:25.224Z","i9bl5yxbuh8vdw3","else if","2026-04-10 16:08:14.236Z",{"collectionId":17,"collectionName":18,"created":24,"created_by":13,"id":25,"name":26,"updated":27,"updated_by":13},"2026-03-04 08:34:25.902Z","m3pk809c4skki8w","control flow","2026-04-10 16:08:14.485Z",{"collectionId":17,"collectionName":18,"created":29,"created_by":13,"id":30,"name":31,"updated":32,"updated_by":13},"2026-03-04 08:20:33.316Z","ln1ntwattzmxo0o","programming","2026-04-10 16:07:27.299Z",{"collectionId":17,"collectionName":18,"created":34,"created_by":13,"id":35,"name":36,"updated":37,"updated_by":13},"2026-03-04 08:20:11.547Z","ey3puyme01a9bsw","Go","2026-04-10 16:07:25.893Z",{"collectionId":17,"collectionName":18,"created":39,"created_by":13,"id":40,"name":41,"updated":42,"updated_by":13},"2026-03-04 08:34:28.167Z","vbpls11idbswpbf","If-Else","2026-04-10 16:08:15.206Z",{"code":44,"collectionId":45,"collectionName":46,"created":47,"flag":48,"id":49,"is_default":50,"label":51,"updated":52},"en","pbc_1989393366","locales","2026-01-22 11:00:02.726Z","twemoji:flag-united-states","qv9c1llfov2d88z",false,"English","2026-04-10 15:42:46.825Z",{"category":54,"collectionId":55,"collectionName":56,"created":13,"expand":57,"id":71,"slug":72,"updated":13,"views":73},"wqxt7ag2gn7xcmk","pbc_2105096300","school_blogs",{"category":58},{"blogIds":59,"collectionId":60,"collectionName":61,"created":62,"created_by":13,"id":54,"image":63,"image_alt":13,"image_path":64,"label":65,"name":66,"priority":67,"publish_at":68,"scheduled_at":13,"status":69,"updated":70,"updated_by":13},[],"sclcatblg987654321","school_category_blogs","2026-03-04 08:33:53.210Z","59ty92ns80w_15oc1implw.png","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclcatblg987654321\u002Fwqxt7ag2gn7xcmk\u002F59ty92ns80w_15oc1implw.png",{"en":66,"th":66},"Golang The Series",1,"2026-03-16 04:39:38.440Z","published","2026-04-25 02:32:15.470Z","y2mcgmjwrp345w1","enhance-your-program-intelligence-with-if-else",205,"yk2ce2j4f5epk77",[20,25,30,35,40],"2025-01-21 07:02:41.540Z","Learn how to use If-Else and else if in Go language to effectively control your program's execution.","2026-04-22 07:11:51.023Z",{"th":72,"en":72}]