unrust

Text & code diff checker

Compare two snippets line by line. See added and removed lines, check final newlines and optionally ignore trailing spaces. No code is executed.

Free to use · No sign-up · Inputs stay in your browser

See what changed

Compare two snippets, configuration files or drafts. This example changes a defaulting operator so a supplied zero stays zero. No code is executed.

Up to 400 lines and 40,000 characters per side. CRLF and CR line endings are normalized to LF. Line numbers refer to the original inputs.

Line comparison

1 added, 1 removed.

Final newline — before: yes; after: yes.

BeforeAfter+/−Text
11equalfunction retries(value) {
2removed return value || 3;
2added return value ?? 3;
33equal}
Copy or download the comparison report

Practice explaining a behavior change

A diff changes value || 3 to value ?? 3. What happens when value is 0, and what decides whether the change is correct?

Check the reasoning

The old expression returns 3; the new one returns 0. Whether that is correct depends on whether zero is valid in the contract. A smaller diff does not mean a smaller behavior change. Check null, undefined and other relevant inputs too.

This is an original open example, not a scored drill. Close the tool before taking a diagnostic or an unassisted practice session.

About 14 minutes, no account needed. A free account adds a daily practice queue; paid plans add more practice and the full library.

How to use the result

Paste before and after text, then inspect the line comparison. Each side accepts up to 400 lines and 40,000 characters. CRLF and CR become LF for comparison. Trailing-space ignoring is optional; final-newline differences remain visible. The downloadable report is readable text, not an apply-ready patch.

The example reports one removed line and one added line. Changing || to ?? preserves an explicit zero; the diff shows the edit, but a reviewer still needs to decide whether that behavior matches the contract.

These utilities and open examples do not contribute to your diagnostic score or practice history.

Git: diff and whitespace comparison options

Work through the example

Read a code diff for behavior, not just changed lines →