why can’t you assign a number with a decimal point to decimal type directly without using type suffix?

Edit: I may have missed the last part of the question, so the overview below is hardly useful.

Anyway, the reason you can’t do what you’re trying to do is because there is no implicit conversion between floating point types and decimal. You can however assign it from an integer, as there is an implicit conversion from int to decimal.


You can, but you have to use this syntax (or do an explicit cast to decimal).

decimal bankBalance = 3433.20m;

and for floats it is

float bankBalance = 3433.20f;

default is double

double bankBalance = 3444.20;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)