Decimal problem?

The following assignment generates a compilation error:

decimal accountBalance = 1550.30;

This code generates the error. "Literal of type double cannot be implicitly converted to type 'decimal';...". To avoid this error, which suffix would you append to the literal value?
mathieu_cuprykAsked:
Who is Participating?
 
ozymandiasConnect With a Mentor Commented:
decimal accountBalance = 1550.30M;
0
 
_TAD_Commented:


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
 
_TAD_Commented:


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
_TAD_Commented:


if I am not mistaken, this should work....


decimal accountBalance = 1550.30m;

0
 
ozymandiasCommented:
I think you need uppercase M.
TAD...you are posting everything 3 times dude.
0
 
mathieu_cuprykAuthor Commented:
It should be big M
0
 
ozymandiasCommented:
Is this a quiz ?
0
 
mathieu_cuprykAuthor Commented:
No I am helping a friend with some practice questions.



0
 
mathieu_cuprykAuthor Commented:
It is to help us improve.
0
 
_TAD_Commented:

Nope, it doesn't matter.

m and M work equally well.


...and I can't help the triple post.  sometimes it posts multiple times and sometimes it does not.  I think it may be the proxy server I'm going through.
0
 
ozymandiasCommented:
> m and M work equally well
Wow. I did not know that. Never tried it. I am a bit surprised actually.
0
All Courses

From novice to tech pro — start learning today.