0

deposit = sellingPrice == 0 ? 0 : (sellingPrice - interest)

What is the above in terms of pseudo-code, I am rusty on ternary operators and operator precedence as complex as this.

0

2 Answers 2

5

If sellingPrice == 0 then deposit = 0

else

deposit = (sellingPrice - interest) 

As per docs

Use the ?: operator instead of an if-then-else statement if it makes your code more readable;

Sign up to request clarification or add additional context in comments.

Comments

2

deposit is assigned 0 if sellingPrice equals 0 or sellingPrice - interest if not

same thing as

if(sellingPrice == 0){ deposit = 0; } else{ deposit = (sellingPrice - interest); } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.