Quick entry instructions if

How to convert a normal record, the statement:

zmienna=x^50?zmienna:nowa_wartosc;

?
And what is this character: “^”?

I tried:

if(x^50)
{
  zmienna=zmienna; // I know...meaningless?
}
else
{
  zmienna=nowa_wartosc;
}

But it probably is wrong.

What is the context of your question?
From whence does this data come? If it was a form (input from the user) there is no way to be sure of the significance of that expression.

More importantly, don’t forget that “^” (commonly called the Caret) is simply another [URL=“http://en.wikipedia.org/wiki/ASCII”]ASCII character. Again, the meaning of it is purely subjective. We tend to assume it represents an [URL=“http://cboard.cprogramming.com/cplusplus-programming/8789-exponential-operator.html”]exponential operator. But that may not be true.

The code you present is a ternary operator which you correctly changed to a if/else

zmienna=x^50?zmienna:nowa_wartosc;

this part

x^50

JavaScript needs to evaluate that to a true or false for it to work.

the “^” in this case is a “bitwise XOR” (A bit of home work for you).

So depending on what the “X” value is in relation to “50” the result will a true of false

drop this into a web page and play…


var bw;
bw = '';
bw = 3^4?'yes':'no';
alert(bw);

try 3^3 as well