Programming
How one language or tool really behaves: the mechanism, a snippet that runs, and where it breaks.
GoByte Skills: 9 tracks. One mechanism, one snippet, one animation.
See the seriesLatest in Programming
RSS-
Motion from zero: reduced motion sets the duration to zero
Some readers ask the system for less motion. Honor it by using a duration of 0. The program prints 320 for a normal run and 0 when motion is reduced.
-
CSS from zero: a class can name what is inside
A descendant selector styles an element inside the class. .price strong sets the weight of the price without restyling every strong on the page.
-
CSS from zero: a custom property is a named value
A custom property stores a value under a name you choose. --ink holds a color. color: var(--ink) uses it. Change the name once and the users follow.
-
JavaScript from zero: pass the object
A function can take the object and read the fields it needs. price takes a drink and returns the label. The program prints latte $4.50.
-
JavaScript from zero: a method needs its object
Pulling a method off the object and calling it loses this. The detached call throws. Calling label on the latte prints latte $4.50.
-
TypeScript from zero: an interface is a method list
An interface lists the methods a function needs. Labeller asks for label. Item has label. show prints latte $4.50.
-
TypeScript from zero: a union names the cases
A union is a value that is one of several shapes. Paid is yes with the cents, or no. Reading yes prints paid 450. Reading no prints unpaid.
-
Rust from zero: a trait is a method list
A trait names the methods a function needs. Label asks for label. Item implements it. show prints latte $4.50.
-
Rust from zero: an enum names the cases
An enum lists the shapes a value can have. Paid is Yes with the cents, or No. The program prints paid 450 and unpaid.
-
Python from zero: a method is enough
A function can call label on any object that has label. Item has that method. show prints latte $4.50.
-
Python from zero: money is a Decimal
A price is a Decimal made from a string, not a float. Three americanos at 4.10 print 12.30, and the total equals Decimal("12.30").
-
Java from zero: one method is enough to call
An interface is the method list a function needs. Labeller asks for label. Item has label. show prints latte $4.50.