Programming Languages: Common Sources of Confusion

[not yet finished]

Division: Integer Division

Division: Truncated Division v. Floor Division v. True Division

trunc warning: -1 // 2 becomes 0

Modulo: Truncated Modulo v. Floor Modulo

trunc: % 1 AKA frac()

Modulo: Euclidean

trunc: % 1 AKA frac()

Rounding: Ceil / Floor / Trunc aka Int / Banker's

Sort: Sort Comparator Functions

Sort: Sort Comparator Functions: Compare v. Equals

Sort: Sort Comparator Functions: Map v. Compare

Python-style sort functions

Sort: Sort Comparator Functions: Stable Sort

Sort: Alphabetical Sort v. Numerical Sort

Sort: Case-Insensitive Sort

Sort: Natural Sort

Off-By-One Errors

Two's Complement

Indexes: Zero-Based v. One-Based

array length

Indexes: Caret Position v. Character Index

Indexes: Substrings: 'Start, End' v. 'Start, Length'

Indexes: XYWH Coordinates v. XYRB Coordinates

Indexes: XY Coordinates v. RC Coordinates

Indexes: Column Numbers (Letters To Numbers)

Reduce: Reduce Without Seed (Fold Without Seed)

Reduce: Reduce With Seed (Fold With Seed)

Reduce: Reduce Right Without Seed (Fold Right Without Seed)

Reduce: Reduce Right With Seed (Fold Right With Seed)

Operators: Unary/Binary/Ternary

high precedence, happens first [weak barrier] low precedence, happens last [like a brick wall] [strong barrier]

Operator Precedence: || v. &&

high precedence, happens first [weak barrier] low precedence, happens last [like a brick wall] [strong barrier]

Operator Precedence: BODMAS

Operator Precedence: Unary Minus

Operator Precedence: Right-Associative Operators

Operator Precedence: Nested Ternary Operator

Operators: +: Addition v. Concatenation

Operators: Ternary Operator / Short Ternary Operator / Null-Coalescing Operator

Combinatorics: Combinations/Permutations (With/Without Repetition)

Mathematics: Sign: Signum/Signbit

Mathematics: ATan2 Parameter Order

Signed v. Unsigned

Truthy v. Falsy

Ruby.

Clamping

if (x > max) x = max AKA x = min(x, max) if (x < min) x = min AKA x = max(x, min)

Log: Log10 v. Ln

Negative Zero

Bitshifting v. Powers of 2

Splicing

Reference Counting

Inclusive Range v. Exclusive Range

Escape Characters: Literal Backslash

Page Numbers: Real Page Numbers V. PDF Page Numbers

Strings: 'IsUpper' / 'IsLower'

'IsUpper' commonly returns true if each char in a string is an upper-case letter. E.g. AutoHotkey: vIsMatch := RegExMatch(vText, "^[A-Z]*$") A different definition is: E.g. AutoHotkey: vIsMatch := (vText == StrUpper(vText)) Returns true if 'ToUpperCase' applied to a string leaves the string unmodified.

Dates: Leap Years

Dates: Date Order: Day v. Month

Dates: Daylight Saving Time Starts/Ends

Dates: Adding/subtracting Months/Years

Dates: Counting Months/Years