Computers are extremely good at following directions. You can think of a computer as a very efficient and experienced waiter who follows your order exactly. But the real "driving force" behind this efficiency is the Conditional Statement.
Whether it's checking if a number is even or deciding if you've won a game, it all works on this structure. Conditional statements are fundamental concepts in the world of programming that allow code to execute only when specific conditions are met.
Imagine a real-world scenario: If it's raining outside, stay inside; else, go out. In Python, we have three primary ways to handle these choices.
1. The if Statement: The Security Guard
Think of a school security guard on duty at night. He has one specific instruction:
"Check if any light in the building is on. If it is, turn it off."
If the light is already off, he simply goes back to the gate. He doesn't have a "Plan B"; he only acts if the specific condition (Light is ON) is true.
In Technical Terms: The if statement executes a block of code only if the condition is True. If it's False, Python ignores the code entirely.
#The Security Guard Logic
light_is_on = True
if light_is_on:
print("Action: Turn the light off.")
2. The if-else Statement: The Cricket Toss
Consider the toss at the start of a cricket match. This is a "two-way" choice:
If it's Heads → Team A will bat first.
Else (it must be Tails) → Team A will bowl first.
In technical terms, if the condition is true, the first statement executes; if it is false, the else statement executes.
#The Cricket Toss Logic
toss_result = "Tails"
if toss_result == "Heads":
print("Team A will Bat first.")
else:
print("Team A will Bowl first.")
3. The if-elif-else Ladder: The Restaurant Menu
Imagine you are at a restaurant with a limited amount of cash in your pocket. You have to make a choice based on your budget:
If you have Rs. 500 → Eat Chicken Biryani.
Elif (Else-if) you have Rs. 300 → Eat Chicken Pulao.
Else (less than Rs. 300) → Just get a Milkshake.
In Technical Terms: This statement chooses between multiple conditions. As soon as one is found True, it executes that specific block and skips the rest.
# The Budget Logic
cash_in_hand = 450
if cash_in_hand >= 500:
print("Ordering: Chicken Biryani")
elif cash_in_hand >= 300:
print("Ordering: Chicken Pulao")
else:
print("Ordering: Chilled Milkshake")
🔢 Mathematical Application: The Even-Odd Logic
To see how this works in a mathematical context, let’s look at how a computer identifies even and odd numbers. We use the Modulo Operator (%), which gives us the remainder of a division.
A) The Simple Check (If)
Checking for a single specific condition.
n = 10
if n % 2 == 0:
print("The number is Even")
B) The Two-Way Categorization (If-Else)
Handling both possibilities.
n = 7
if n % 2 == 0:
print("Even")
else:
print("Odd")
C) The Multi-Case Logic (If-Elif-Else)
Checking for Positive, Negative, or Zero.n = 0
if n > 0:
print("Positive Number")
elif n < 0:
Conclusion
Conditional statements are the "brain" of your code. By mastering these three structures, you can build programs that react to the world just like we do.
Read more of this story at Slashdot.
On January 14, 2006, John Resig introduced a JavaScript library called jQuery at BarCamp in New York City. Now, 20 years later, the jQuery team is happy to announce the final release of jQuery 4.0.0. After a long development cycle and several pre-releases, jQuery 4.0.0 brings many improvements and modernizations. It is the first major version release in almost 10 years and includes some breaking changes, so be sure to read through the details below before upgrading. Still, we expect that most users will be able to upgrade with minimal changes to their code.
Many of the breaking changes are ones the team has wanted to make for years, but couldn’t in a patch or minor release. We’ve trimmed legacy code, removed some previously-deprecated APIs, removed some internal-only parameters to public functions that were never documented, and dropped support for some “magic” behaviors that were overly complicated.
We have an upgrade guide and jQuery Migrate plugin release ready to assist with the transition. Please upgrade and let us know if you encounter any issues.
As usual, the release is available on our CDN and the npm package manager. Other third party CDNs will probably have it available soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 4.0.0.
jQuery 4.0 drops support for IE 10 and older. Some may be asking why we didn’t remove support for IE 11. We plan to remove support in stages, and the next step will be released in jQuery 5.0. For now, we’ll start by removing code specifically supporting IE versions older than 11.
We also dropped support for other very old browsers, including Edge Legacy, iOS versions earlier than the last 3, Firefox versions earlier than the last 2 (aside from Firefox ESR), and Android Browser. No changes should be required on your end. If you need to support any of these browsers, stick with jQuery 3.x.
jQuery 4.0 adds support for Trusted Types, ensuring that HTML wrapped in TrustedHTML can be used as input to jQuery manipulation methods in a way that doesn’t violate the require-trusted-types-for Content Security Policy directive.
Along with this, while some AJAX requests were already using <script> tags to maintain attributes such as crossdomain, we have since switched most asynchronous script requests to use <script> tags to avoid any CSP errors caused by using inline scripts. There are still a few cases where XHR is used for asynchronous script requests, such as when the"headers" option is passed (use scriptAttrs instead!), but we now use a <script> tag whenever possible.
It was a special day when the jQuery source on the main branch was migrated from AMD to ES modules. The jQuery source has always been published with jQuery releases on npm and GitHub, but could not be imported directly as modules without RequireJS, which was jQuery’s build tool of choice. We have since switched to Rollup for packaging jQuery and we do run all tests on the ES modules separately. This makes jQuery compatible with modern build tools, development workflows, and browsers through the use of <script type=module>.
These functions have been deprecated for several versions. It’s time to remove them now that we’ve reached a major release. These functions were either always meant to be internal or ones that now have native equivalents in all supported browsers. The removed functions include:
jQuery.isArray, jQuery.parseJSON, jQuery.trim, jQuery.type, jQuery.now, jQuery.isNumeric, jQuery.isFunction, jQuery.isWindow, jQuery.camelCase, jQuery.nodeName, jQuery.cssNumber, jQuery.cssProps, and jQuery.fx.interval.
Use native equivalents like Array.isArray(), JSON.parse(), String.prototype.trim(), and Date.now() instead.
The removal of deprecated APIs combined with the removal of code supporting old IE the result is a size reduction over 3k bytes gzipped.
The jQuery prototype has long had Array methods that did not behave like any other jQuery methods and were always meant for internal-use only. These methods are push, sort, and splice. They have now been removed from the jQuery prototype. If you were using these methods, $elems.push( elem ) can be replaced with [].push.call( $elems, elem ).
For a long time, browsers did not agree on the order of focus and blur events, which includes focusin, focusout, focus, and blur. Finally, the latest versions of all browsers that jQuery 4.0 supports have converged on a common event order. Unfortunately, it differs from the consistent order that jQuery had chosen years ago, which makes this a breaking change. At least everyone is on the same page now!
Starting with jQuery 4.0, we no longer override native behavior. This means that all browsers except IE will follow the current W3C specification, which is:
jQuery’s order in previous versions was: focusout, blur, focusin, focus. Ironically, the only browser to ever follow the old W3C spec (before it was updated in 2023) was Internet Explorer.
The slim build has gotten even smaller in jQuery 4.0.0 with the removal of Deferreds and Callbacks (now around 19.5k bytes gzipped!). Deferreds have long-supported the Promises A+ standard, so native Promises can be used instead in most cases and they are available in all of jQuery’s supported browsers except IE11. Deferreds do have some extra features that native Promises do not support, but most usage can be migrated to Promise methods. If you need to support IE11, it’s best to use the main build or add a polyfill for native Promises.
You can get the files from the jQuery CDN, or link to them directly:
https://code.jquery.com/jquery-4.0.0.js
https://code.jquery.com/jquery-4.0.0.min.js
You can also get this release from npm:
npm install jquery@4.0.0
Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Finally, all of jQuery’s supported browsers (except for IE11) now have support for native Promises across the board, so Deferreds and Callbacks are no longer needed in most cases. Along with the regular version of jQuery that includes everything, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 8k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:
https://code.jquery.com/jquery-4.0.0.slim.js
https://code.jquery.com/jquery-4.0.0.slim.min.js
These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.
Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including Alex, Ahmed S. El-Afifi, fecore1, Dallas Fraser, Richard Gibson, Michał Gołębiowski-Owczarek, Pierre Grimaud, Gabriela Gutierrez, Jonathan, Necmettin Karakaya, Anders Kaseorg, Wonseop Kim, Simon Legner, Shashanka Nataraj, Pat O’Callaghan, Christian Oliff, Dimitri Papadopoulos Orfanos, Wonhyoung Park, Bruno PIERRE, Baoshuo Ren, Beatriz Rezener, Sean Robinson, Ed Sanders, Timo Tijhof, Tom, Christian Wenz, ygj6 and the whole jQuery team.
Lots of wonderful people have contributed to jQuery and its associated projects in the past 20 years and many of us met up for a reunion in Dallas. John Resig even joined over Zoom. This release was posted while we were all together.

Full changelog: 4.0.0
processData: true even for binary data (ce264e07)headers for script transport even when cross-domain (#5142, 6d136443)null as success functions in jQuery.get (#4989, 74978b7e).attr( name, false ) remove for all non-ARIA attrs (#5388, 063831b6)toggleClass(boolean|undefined) signature (#3388, a4421101)<col> elements (#5628, eca2a564)selector.js wrapper (53cf7244)offsetHeight( true ), etc. include negative margins (#3982, bce13b72)undefined for whitespace-only CSS variable values (#5120) (7eb00196)addClass( array ), compress code (#4998, a338b407)show, hide & toggle methods in the jQuery slim build (297d18dd)$.parseHTML from document.implementation to DOMParser (0e123509)src/ (#5262, f75daab0)
(d0ce00cd)getStackHook to getErrorHook (#5201, 258ca1ec).hover() using non-deprecated methods (fd6ffc5e)3.x-stable (d9281061)trac-NUMBER references (eb9ceb2f)#NUMBER Trac issue references with trac-NUMBER (5d5ea015).preventDefault() in beforeunload (7c123dec).on(focus).off(focus) (#4867, e539bac7)npm publish in the post-release phase (ff1f0eaa):has; test both on iPhone & iPad (65e35450)jQuery.expr[ ":" ]/jQuery.expr.filters (329661fd)selector.js module depend on attributes/attr.js (#5379, e06ff088)selector.js depenencies from various modules (e8b7db4b)qSA again (#5177, 09d988b7)uniqueSort chainable method (#5166, 5266f23c):has if CSS.supports(selector(...)) non-compliant (#5098, d153c375)In this stream, I'll add a project to compare two different ways to implement the custom BigInteger format I created in the last stream. Which one is better? Only one way to find out!