This is needed because Go is strict about types and does not allow automatic conversions. This helps prevent hidden bugs, makes code behavior predictable, and forces developers to be explicit about how values of different types should interact.
Float to Integer
Casting fromfloat to integer removes (cuts off) the decimal part: