Loading views...

Boolean

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2025 Nov 14 0:46
Editor
Edited
Edited
2025 Nov 14 0:58
Refs
Refs

Booleans feel like they make sense for our data or state, but they make sense for our logic

This means using it inside a function as a conditional variable
{ completed: boolean, failed: boolean, in_progress: boolean, }
easy to miss in if statement of the client code

Enum Data

{ status: 'failed' | 'completed' | 'in_progress' }
 

Check authorization

fn check_permissions(user: User) -> bool { false // no one is allowed to do anything i guess }
the application logic meaning of the value cannot be inferred from the type.
enum PermissionCheck { Allowed, NotPermitted(reason: String), }
 
 
 

Please Stop Using Booleans.

 

Recommendations