liveBook · Manning

Comparison

A comparison is a language operation that evaluates a relationship, such as equality or ordering, between values and produces a result representing that relationship.

How 9 Manning books explain it

A Pythonic Adventure: From Python basics to a working web app

A comparison operator evaluates a relationship between values and produces a Boolean result.

How it is used
Uses equality comparisons to validate menu input before indexing a list.
How deep it goes
Explains ==, separate comparisons, or, invalid inputs, and looped validation, but does not develop comparison operators beyond equality.
Examples
Uses a drinks menu, numbered choices, invalid entries, exit commands, and a final menu function.
What you can do after
Apply it via Python to validate interactive menu choices and route valid or invalid input.

Read how A Pythonic Adventure: From Python basics to a working web app explains comparison →

Learn AI-Assisted Python Programming, Second Edition

How it is used
Uses comparisons to make conditional decisions and select or count values meeting specified criteria.
How deep it goes
Defines Boolean comparisons and demonstrates them in conditionals, but does not develop identity or membership comparisons.
Examples
Demonstrates larger-value selection, age-based prompts, longest-word tests, and inclusive versus exclusive numeric ranges.
What you can do after
Diagnose boundary bugs and apply comparisons in Python conditionals and doctest-backed functions.

Read how Learn AI-Assisted Python Programming, Second Edition explains comparison →

JavaScript in Depth

Language semantics and operators for testing relational ordering or equality between values.

How it is used
Diagnoses surprising equality, ordering, sorting, and string-matching results in JavaScript.
How deep it goes
Works through loose-equality conversions, contrasts relational coercion, and explains UTF-16 string comparison and normalization.
Examples
Uses `true == '1'`, mixed-type ordering, default array sorting, and visually identical usernames with different Unicode sequences.
What you can do after
Diagnose/debug with it by identifying unintended coercion, string sorting, and Unicode-equivalence failures before choosing a comparison strategy.

Read how JavaScript in Depth explains comparison →

Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS

A comparison is an expression that evaluates a relationship between values and produces a Boolean result.

How it is used
Uses Boolean tests to filter objects retrieved into the PowerShell pipeline.
How deep it goes
Explains operator categories, Boolean logic, placeholders, properties, and pipeline behavior through process-filtering examples.
Examples
Demonstrates numeric, date, string, process-response, and process-memory comparisons.
What you can do after
Apply comparisons through Where-Object to retain pipeline objects matching numeric, property-based, or combined conditions.

Read how Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS explains comparison →

Modern C, Third Edition

A comparison operator is a C operator that evaluates a relational condition between two operands and produces a Boolean result.

How it is used
Uses relational expressions in control flow, arithmetic, and array indexing.
How deep it goes
Defines six operators and their 0-or-1 results, with worked arithmetic examples but no deeper evaluation mechanics.
Examples
Uses relational arithmetic with a and b and classifies array elements by comparing them with 1.0.
What you can do after
Apply comparisons in conditions, arithmetic expressions, and Boolean-indexed arrays.

Read how Modern C, Third Edition explains comparison →

The Well-Grounded Rubyist, Fourth Edition

A comparison operator is Ruby syntax that compares two values or objects for ordering or equality.

How it is used
Explains how Ruby objects define equality and ordering, then use Comparable to supply a full operator family.
How deep it goes
Shows a Bid implementation, the spaceship method’s return convention, and a shorter delegation to numeric estimates.
Examples
Uses bids ordered by estimates and notes that strings compare for equality and order.
What you can do after
Build from scratch a class whose objects support Ruby comparison operators by defining `<=>` and including Comparable.

Read how The Well-Grounded Rubyist, Fourth Edition explains comparison →

Modern C

A comparison operator is a C operator that compares values and produces a Boolean result represented by zero or one.

How it is used
Deploys comparisons in expressions, control statements, arithmetic, and array indexing.
How deep it goes
Explains six comparison operators and their 0-or-1 results through worked expressions, without developing logical evaluation.
Examples
Uses equality-counting expressions and an array-indexing loop that classifies values relative to 1.0.
What you can do after
Apply comparison results as Boolean values in conditions, arithmetic expressions, and array subscripts.

Read how Modern C explains comparison →

Python Workout, Second Edition

A comparison operator is a Python operator that evaluates a relationship between two values and produces a Boolean result.

How it is used
Drives a number-guessing loop by testing a user's guess against a randomly chosen integer.
How deep it goes
Explains ==, !=, <, and > through a worked program and type restrictions, without surveying additional comparison behavior.
Examples
Uses a random-integer guessing exercise with converted user input and equality, less-than, and greater-than tests.
What you can do after
Apply it via Python comparisons that control a loop and distinguish numeric guesses from a randomly selected answer.

Read how Python Workout, Second Edition explains comparison →

Math for Web Design

A comparison operator is an operator that specifies the relationship to test between two values.

How it is used
Deploys comparisons to control responsive layouts, validation, sizing, positioning, and animation decisions.
How deep it goes
Explains operator meanings, CSS shorthand, JavaScript coercion, strict equality, and numeric conversion through practical examples.
Examples
Uses responsive breakpoints, clamped font sizes, input selectors, password length checks, and string-to-number comparisons.
What you can do after
Apply comparisons via CSS and JavaScript to make predictable layout, validation, and animation decisions.

Read how Math for Web Design explains comparison →

Also covered in

What to know first

Related concepts

Questions about comparison

What is comparison?

A comparison is a language operation that evaluates a relationship, such as equality or ordering, between values and produces a result representing that relationship.

Which Manning books explain comparison?

A Pythonic Adventure: From Python basics to a working web app, Learn AI-Assisted Python Programming, Second Edition, JavaScript in Depth, Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS, Modern C, Third Edition, The Well-Grounded Rubyist, Fourth Edition, Modern C, Python Workout, Second Edition and 1 more.

What should I know before learning comparison?

Manning books that teach comparison usually introduce string, boolean, object and regular expression first.

What is the difference between comparison and array?

A comparison is a language operation that evaluates a relationship, such as equality or ordering, between values and produces a result representing that relationship. An array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.

What kinds of comparison are there?

Kinds of comparison include string comparison and greater-than-or-equal operator.

What is comparison a kind of?

Comparison is a kind of operator. An operator is a symbol, keyword, or language construct that specifies an operation on one or more operands.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.