Definition of value

Definition of value

What is definition of value mentioned in, for example, string(variableName | value)? Are value and expression same? It looks like that value can take the form 32 * 12 * multiplier.

What can be value of right hand side of arithmetic = operator?

9 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Form the examples I would infer that its a general expression.

The string function can take as inputs a value, an expression and a variable name. Hope this clarifies.

Thanks
-Rama

Hey Minh-Nhut Hong,The following calls to string were provided as examples in the problem definition:

var str3 = string(35 + 12);

string(32 * 12 * multiplier);

string(3450.212);

string(double);

string(result);

var str3 = string(35 + 12);

var str4 = "result: " + string(50 / 2);

output("srq: " + string(sqrt(30)));

output("Value for a: " + string(a));

output("Value for b: " + string(b));

var message = "a / b = ";

message = message + string(a / b);

Rama already provided the answer to your question. However, I just wanted to provide some extra feedback. If you take a look at all the examples provided, you'll understand how things must work.Cheers,Gaston

This code is correct?

var a = 1+-5;

var b = -+-a + 5;

Ret:

a = -4;

b = 1;

Quoting

This code is correct?

var a = 1+-5;

var b = -+-a + 5;

Ret:

a = -4;

b = 1;

It is my understanding that unary operators aren't support so things like 'a=1+-5' and b=-+-a+5' would be invalid.

Once again I'd like to be able to implement a general unary expression or special-case leading negative and be assured that problem set will not explicitly require syntax error on input like:var c = -(a+b);

thanks dweeberlyloom

I want to support thegeneral unary expression

What's the point of unary negation? Why add more complexity to this already out of hand syntax when there is so little time left to implement a solution?My vote goes for 0 - 1 style negation. It gets the job done without changing the spec.

Leave a Comment

Please sign in to add a comment. Not a member? Join today