[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1349
  • Last Modified:

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?
0
mathieu_cupryk
Asked:
mathieu_cupryk
  • 4
  • 4
  • 3
1 Solution
 
_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
 
_TAD_Commented:


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


decimal accountBalance = 1550.30m;

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ozymandiasCommented:
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 4
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now