What is a conditional statement?

This is a recommends products dialog
Top Suggestions
Starting at
View All >
Language
French
English
ไทย
German
繁體中文
Country
Hi
All
Sign In / Create Account
language Selector,${0} is Selected
Register & Shop at Lenovo Pro
Register at Education Store
Pro Tier Benefits
• Save up to an extra 20% on Think everyday pricing.
• Spend $15K, advance for FREE to Plus Tier with increased benefits.
Plus Tier Benefits
• Save up to an extra 25% on Think everyday pricing.
• Spend $50K, advance for FREE to Elite Tier with increased benefits.
Elite Tier Benefits
• Save up to an extra 30% on Think everyday pricing.
Reseller Benefits
• Access to Lenovo's full product portfolio
• Configure and Purchase at prices better than Lenovo.com
View All Details >
more to reach
PRO Plus
PRO Elite
Congratulations, you have reached Elite Status!
Pro for Business
Delete icon Remove icon Add icon Reload icon
TEMPORARILY UNAVAILABLE
DISCONTINUED
Temporary Unavailable
Cooming Soon!
. Additional units will be charged at the non-eCoupon price. Purchase additional now
We're sorry, the maximum quantity you are able to buy at this amazing eCoupon price is
Sign in or Create an Account to Save Your Cart!
Sign in or Create an Account to Join Rewards
View Cart
Your cart is empty! Don’t miss out on the latest products and savings — find your next favorite laptop, PC, or accessory today.
Remove
item(s) in cart
Some items in your cart are no longer available. Please visit cart for more details.
has been deleted
Please review your cart as items have changed.
of
Contains Add-ons
Subtotal
Proceed to Checkout
Yes
No
Popular Searches
What are you looking for today ?
Trending
Recent Searches
Hamburger Menu
{"backgroundColor":"#e6f4fa","sideMsg":"","data":[{"pcInfo":"","mAndTabInfo":"","bannerInfo":{"t_id":"Page2c25a670-a473-4e84-837b-ae1510087748","language":{"en_au":"%3Cp%3E%3Cstrong%20style%3D%22text-wrap%3A%20wrap%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fp2-ofp.static.pub%2FShareResource%2Fanz%2Fimg%2FMasthead_Carousel%2Flfs-logo--reversed.svg%22%20alt%3D%22logo%22%20width%3D%2290%22%20height%3D%2218%22%20style%3D%22text-wrap-style%3A%20initial%3B%22%2F%3E%3C%2Fstrong%3E%3Cspan%20style%3D%22text-wrap%3A%20wrap%3B%22%3E%26nbsp%3B%7C%26nbsp%3BEXTRA%205%25%20off%20selected%20products%20%2B%202X%20rewards%20points.%20%5E%3Ca%20href%3D%22%2Fshopping-faqs%2Fgem-visa%2F%3FipromoID%3Dau_hello_bar_latitude%22%20target%3D%22_blank%22%20textvalue%3D%22T%26amp%3BCs%22%20style%3D%22text-wrap-style%3A%20initial%3B%20color%3A%20rgb(41%2C%2078%2C%20149)%3B%20text-decoration%3A%20underline%3B%22%3E%3Cspan%20style%3D%22text-wrap%3A%20wrap%3B%20color%3A%20rgb(41%2C%2078%2C%20149)%3B%22%3ET%26amp%3BCs%3C%2Fspan%3E%3C%2Fa%3E%3Cspan%20style%3D%22text-wrap%3A%20wrap%3B%20color%3A%20rgb(41%2C%2078%2C%20149)%3B%22%3E%26nbsp%3B%3C%2Fspan%3Eapply.%26nbsp%3B%3Ca%20href%3D%22%2Fcontact%2Fsales-support%2F%22%20target%3D%22_blank%22%20textvalue%3D%22Chat%20Now%20to%20Order%22%20style%3D%22text-wrap-style%3A%20initial%3B%20color%3A%20rgb(41%2C%2078%2C%20149)%3B%20text-decoration%3A%20underline%3B%22%3E%3Cspan%20style%3D%22text-wrap%3A%20wrap%3B%20color%3A%20rgb(41%2C%2078%2C%20149)%3B%22%3EChat%20Now%20to%20Order%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fspan%3E%3C%2Fp%3E","en":""},"id":"Page2c25a670-a473-4e84-837b-ae1510087748"},"gInfo":""},{"pcInfo":"","mAndTabInfo":"","bannerInfo":{"t_id":"Page807d43be-aaf2-4c29-8fc3-b6d20867fb0a","language":{"en_au":"%3Cp%3E%3Cimg%20src%3D%22https%3A%2F%2Fp3-ofp.static.pub%2FShareResource%2Fanz%2Fimg%2FAU-amazonmusic-unlimited-horizontal-130x26-0827.png%22%20alt%3D%22Amazon%20Music%20Unlimited%22%20width%3D%22130%22%20style%3D%22text-wrap%3A%20wrap%3B%22%2F%3E%3Cspan%20style%3D%22text-wrap%3A%20wrap%3B%22%3E%26nbsp%3BGet%204%20months%20Free.%20%2412.99%2Fmonth%20after.%20New%20subscribers%20only.%20Terms%20apply.%26nbsp%3B%3C%2Fspan%3E%3Ca%20href%3D%22https%3A%2F%2Fwww.lenovo.com%2Fau%2Fen%2Fp%2Faccessories-and-software%2Fsoftware-subscription%2Famazon-subscription%2Frr00125299%3FipromoID%3Dau_pc_carousel_banner_amu%22%20target%3D%22_blank%22%20style%3D%22text-wrap%3A%20wrap%3B%20color%3A%20rgb(79%2C%20129%2C%20189)%3B%22%3ELEARN%20MORE%3C%2Fa%3E%3C%2Fp%3E","en":""},"id":"Page807d43be-aaf2-4c29-8fc3-b6d20867fb0a"},"gInfo":""},{"pcInfo":"","mAndTabInfo":"","bannerInfo":{"t_id":"Pagedb993c61-6637-48fd-8b8e-b7bf1f150b16","language":{"en_au":"%3Cp%3E%3Cspan%20style%3D%22text-wrap%3A%20wrap%3B%22%3E%26nbsp%3B%3C%2Fspan%3E%3Cimg%20src%3D%22https%3A%2F%2Fp3-ofp.static.pub%2Ffes%2Fcms%2F2022%2F09%2F20%2Fsgy8gw8u4tymopd8g2224x0drocvbb133978.png%22%20alt%3D%22zip-logo%22%20style%3D%22text-wrap-mode%3A%20wrap%3B%22%2F%3E%3Cspan%20style%3D%22text-wrap-mode%3A%20wrap%3B%22%3E%7C%26nbsp%3BEXTRA%205%25%20off%20selected%20products%20%2B%202X%20rewards%20points.%20%5E%3C%2Fspan%3E%3Ca%20href%3D%22%2Fprogram%2Fzipmoney%2F%3FipromoID%3Dau_hello_bar_zip%22%20target%3D%22_blank%22%20textvalue%3D%22T%26amp%3BCs%22%20style%3D%22text-wrap-style%3A%20initial%3B%20color%3A%20rgb(79%2C%20129%2C%20189)%3B%20text-decoration%3A%20underline%3B%22%3E%3Cspan%20style%3D%22text-wrap-style%3A%20initial%3B%20color%3A%20rgb(79%2C%20129%2C%20189)%3B%22%3ET%26amp%3BCs%3C%2Fspan%3E%3C%2Fa%3E%3Cspan%20style%3D%22text-wrap-mode%3A%20wrap%3B%22%3E%26nbsp%3Bapply.%26nbsp%3B%3C%2Fspan%3E%3Ca%20href%3D%22%2Fcontact%2Fsales-support%2F%22%20target%3D%22_blank%22%20textvalue%3D%22Chat%20Now%20to%20Order%22%20style%3D%22text-wrap-style%3A%20initial%3B%20color%3A%20rgb(79%2C%20129%2C%20189)%3B%20text-decoration%3A%20underline%3B%22%3E%3Cspan%20style%3D%22text-wrap-style%3A%20initial%3B%20color%3A%20rgb(79%2C%20129%2C%20189)%3B%22%3EChat%20Now%20to%20Order%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fp%3E","en":""},"id":"Pagedb993c61-6637-48fd-8b8e-b7bf1f150b16"},"gInfo":""},{"pcInfo":"","mAndTabInfo":"","bannerInfo":{"t_id":"Page0e9b3fce-f050-479b-af47-a1fd9fd40650","language":{"en_au":"%3Cp%20style%3D%22text-wrap-mode%3A%20wrap%3B%22%3E%3Cbr%2F%3E%3C%2Fp%3E%3Cp%20style%3D%22text-wrap-mode%3A%20wrap%3B%22%3E%3Cstrong%3EBetter%20Together%3C%2Fstrong%3E%20%7C%20%3Cspan%20style%3D%22text-wrap-mode%3A%20wrap%3B%22%3EGet%2020%25%20off%20selected%20monitors%20%26amp%3B%2035%25%20off%20selected%20Lenovo%20accessories%20with%20your%20new%20PC%20for%20a%20limited%20time.%3C%2Fspan%3E%3C%2Fp%3E%3Cp%20style%3D%22text-wrap-mode%3A%20wrap%3B%22%3E%3Ca%20href%3D%22%2Fd%2Fdeals%2Fblack-friday-sale%2F%3FipromoID%3Dau_pc_carousel_banner_accessories%22%20target%3D%22_self%22%20textvalue%3D%22Shop%20PCs%22%20style%3D%22color%3A%20rgb(84%2C%20141%2C%20212)%3B%20text-decoration%3A%20underline%3B%22%3E%3Cspan%20style%3D%22color%3A%20rgb(84%2C%20141%2C%20212)%3B%22%3EShop%20PCs%3C%2Fspan%3E%3C%2Fa%3E%3C%2Fp%3E%3Cp%3E%3Cbr%2F%3E%3C%2Fp%3E","en":""},"id":"Page0e9b3fce-f050-479b-af47-a1fd9fd40650"},"gInfo":""}],"autoRun":true,"displayTerminal":"pc,tablet,mobile"}


What is a conditional statement?

A conditional statement is a programming construct that allows the execution of specific instructions based on the outcome of a logical condition. In other words, a conditional statement allows a program to decide what action to take based on whether a certain condition is true or false.

How do I write a basic conditional statement?

A basic conditional statement consists of an if-else statement. The if-else statement evaluates a condition and executes one set of instructions if the condition is true and another set of instructions if the condition is false. For example, if (condition) {instructions if true} else {instructions if false}.

What is the difference between an if statement and an if-else statement?

An if statement is a simple conditional statement that executes a block of code if a certain condition is true. An if-else statement is a more complex conditional statement that executes a block of code if a certain condition is true and a different block of code if the condition is false.

How do I use comparison operators in a conditional statement?

Comparison operators are used to compare two values in a conditional statement. Examples of comparison operators include "==" (equal to), "! =" (not equal to), ">" (greater than), "<" (less than), ">=" (greater than or equal to), and "<=" (less than or equal to). For example, if (x > y) {instructions if true} else {instructions if false}.

What is a nested conditional statement?

A nested conditional statement is a conditional statement that is embedded inside another conditional statement. A nested conditional statement is used when multiple conditions need to be evaluated to determine the appropriate action. For example, if (x > y) {if (z > y) {instructions if both conditions are true} else {instructions if only the first condition is true}} else {instructions if the first condition is false}.

What is a switch statement?

A switch statement is another type of conditional statement that allows a program to execute different blocks of code based on the value of a single variable. The switch statement is often used as an alternative to a series of if-else statements when there are many values for the variable. For example, switch (variable) {case 1: instructions if variable is 1; break; case 2: instructions if variable is 2; break; default: instructions if variable is something else;}.

How do I use logical operators in a conditional statement?

Logical operators are used to combining multiple conditions in a conditional statement. Examples of logical operators include "&&" (logical AND), "||" (logical OR), and "!" (logical NOT). For example, if (x > y && y > z) {instructions if both conditions are true} else {instructions if at least one condition is false}.

What is short-circuit evaluation in a conditional statement?

Short-circuit evaluation is a feature of many programming languages that allows a program to evaluate a conditional statement more efficiently. Short-circuit evaluation means that the program only evaluates the second condition of an "&&" or "||" operator if the first condition is not sufficient to determine the outcome of the conditional statement.

What is a ternary operator?

A ternary operator is a type of conditional statement that allows a program to execute one of two expressions based on the value of a Boolean condition. The ternary operator is often used as shorthand for a simple if-else statement. For example, variable = (condition) ? expression1 : expression2.

How do I use multiple conditions in a conditional statement?

To use multiple conditions in a conditional statement, you can combine them using logical operators such as "&&" (logical AND) and "||" (logical OR). For example, if (condition1 && condition2) { instructions if both conditions are true } else { instructions if at least one condition is false }.

What is the difference between "==" and "===" in a Conditional statement?

In a conditional statement, "==" is used to test for value equality between two operands, while "===" is used to test for both value and type equality. For example, if (x == "3") { instructions if x is equal to the string "3" } and if (x === 3) { instructions if x is equal to the number 3 }.

What is a guard clause in a conditional statement?

A guard clause is a conditional statement used at the beginning of a function or method to check for certain conditions that would cause it to fail or behave incorrectly. Guard clauses are often used to improve the readability and maintainability of code. For example, function myFunction(x) { if (x === null) { return; } // rest of function }

How do I handle multiple cases in a switch statement?

To handle multiple cases in a switch statement, you can use the "case" keyword followed by the value to be tested, followed by a colon and the instructions to be executed if that value is matched. You can also use the "default" keyword to provide a set of instructions to be executed if none of the cases match. For example, switch (variable) { case 1: instructions if variable is 1; break; case 2: case 3: instructions if variable is 2 or 3; break; default: instructions if variable is something else; }.

What is a conditional loop?

A conditional loop is a type of loop that executes a set of instructions repeatedly if a certain condition is true. The condition is typically evaluated at the beginning of each iteration of the loop. Examples of conditional loops include the "while" loop and the "do-while" loop.

What is a conditional breakpoint?

A conditional breakpoint is a debugging feature that allows a program to break execution when a certain condition is met. This can be useful for debugging code that is difficult to isolate or reproduce. For example, you can set a conditional breakpoint to pause execution when a certain variable reaches a certain value.

What is short-circuit evaluation in a conditional statement?

Short-circuit evaluation is a technique used by programming languages to optimize conditional statements. When evaluating a Boolean expression that uses the logical AND operator "&&" or the logical OR operator "||", the evaluation stops as soon as the result is determined. For example, in the expression (x != null && x.length > 0), if x is null, the evaluation stops after the first condition and the second condition is not checked.

What is a truthy value in a conditional statement?

In a conditional statement, a truthy value is a true value when used as a Boolean expression. Examples of truthy values include non-empty strings, non-zero numbers, and non-null objects. The opposite of a truthy value is a falsy value, which is a value that is considered false when used as a Boolean expression. Examples of falsy values include empty strings, the number 0, and null.

What is a ternary expression in a conditional statement?

A ternary expression is a shorthand conditional statement that consists of three operands: a Boolean condition, a value to be returned if the condition is true, and a value to be returned if the condition is false. The ternary expression is often used as a concise alternative to an if-else statement. For example, result = (x > 0) ? "positive" : "negative".

What is a conditional statement in SQL?

In SQL, a conditional statement is used to control the flow of data in a query. The most common conditional statement in SQL is the "WHERE" clause, which is used to filter data based on a specified condition. For example, SELECT * FROM mytable WHERE age > 18 would return all rows from the "mytable" table where the "age" column is greater than 18.

{"pageComponentDataId":"e857fdeft7e51-4b61-84dc-bccec6e68e00","pageComponentId":"e857fdeft7e51-4b61-84dc-bccec6e68e00","isAssociatedRelease":"true","pageComponentDataLangCode":"en_au","configData":{"jumpType":"currentTab","headlineColor":"black","displayNumber":"","styleMode":"vertical","miniCardHoMode":"2","headline":"","products":[{"number":{"t_id":"21kccto1wwau5","language":{"en_nz":"21kccto1wwau5","en_au":"21kccto1wwau5","en":""},"id":"Pageb33ce4b8-4839-4ba3-b993-7296d68a91b8"}},{"number":{"t_id":"21mccto1wwau3","language":{"en_nz":"21mccto1wwau3","en_au":"21mccto1wwau3","en":""},"id":"Page1fa61927-074c-4fe0-a8df-5c94362fb75c"}},{"number":{"t_id":"21lkcto1wwau3","language":{"en_nz":"21lkcto1wwau3","en_au":"21lkcto1wwau3","en":""},"id":"Pageca014688-410e-439a-a4c6-bba2ef6d4715"}},{"number":{"t_id":"21g2cto1wwau3","language":{"en_nz":"21g2cto1wwau3","en_au":"21g2cto1wwau3","en":""},"id":"Page79cd32c8-d467-4d68-b955-d273bb24eda7"}}]},"urlPrefix":"AAAAAAAH","title":"glossary-right-blue-boxes-fragment","pageId":"65b55929-de05-417a-a92a-ccb888d329b0","urlEdit":0,"uri":"/FragmentDirectory/glossary/glossary-right-blue-boxes-fragment.frag","pageComponentUuid":"e857fdeft7e51-4b61-84dc-bccec6e68e00"}
coming coming
Starting at
List Price
Web Price
Web Price:
List Price
Web Price
List Price is Lenovo’s estimate of product value based on the industry data, including the prices at which first and third-party retailers and etailers have offered or valued the same or comparable products. Third-party reseller data may not be based on actual sales.
Web Price is Lenovo’s estimate of product value based on industry data, including the prices at which Lenovo and/or third-party retailers and e-tailers have offered or valued the same or comparable products. Third-party data may not be based on actual sales.
Learn More
See More
See Less
View {0} Model
View {0} Models
Part Number:
Features
See More
See Less
compare
Added!
Great choice!
You may compare up to 4 products per product category (laptops, desktops, etc). Please de-select one to add another.
View Your Comparisons
Add To Cart
Add To Cart
We're sorry,
Products are temporarily unavailable.
Continue shopping
Learn More
Coming Soon
Featured Product
Top Deals of the Day
Oops! No results found. Visit the categories above to find your product.
Save
open in new tab
© 2024 Lenovo. All rights reserved.
© {year} Lenovo. All rights reserved.
Compare  ()
x