Sean McGuire

Greenhorn
+ Follow
since Aug 02, 2015
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sean McGuire

Mike. J. Thompson wrote:Java does not use the keyword 'var'. Are you using Java or Javascript? Note these are two different and completely unrelated languages, despite the similar names.



I incorrectly assumed they were one in the same, my bad, I meant Java script. Thanks for clarifying.

Liutauras Vilda wrote:

Sean McGuire wrote:When:
short_description == "Quantum Block"
chargeable_item == true (it's a tick box, default to tick)
populate internal_cost (200.00) (default 200.00 in this field)


Hi Sean, couple of things to remember:

1. Never do not check String objects (or any other object) equality with "==". In this case you'd check if both reference variables refers to the same memory location, where object is stored.
Strings equality you suppose to check:

2. Example below is error-prone, so do not write code in that way:instead write:
If you'd do in your way, you could easily make a mistake, for example:
Can you notice mistake? What the output would be?

3. Variable names suppose to start with lower case, and the second word with an upper. So "changeable_item" you'd change to "changeableItem" and so on, "changeableItemCodeOneTwoThree..."



Firstly, thanks for taking the time to respond, I appreciated it.

In regards to your questions, boolean needs to be replaced by var and the output will error.

How do I go about populating the internal_cost variable with 200.00
Hi Guys,

I am the greenest of green horns and I'm dipping my toes into the java waters for the first time, I'm hoping someone can help me with some basic code: I am working with 3 values: Quantum Block, Chargeable item & Internal Cost.
Essentially what I need is this

When:
short_description == "Quantum Block"
chargeable_item == true (it's a tick box, default to tick)
populate internal_cost (200.00) (default 200.00 in this field)

Any assistance you can provide would be greatly appreciated.