O
optimistx
Osmo said:In fact, TL's response was not only civil, but also cordial.
RTFM.
Your being an anonymous/nicknamed, Google
Groups, clueless newbie, nothing more was to be expected. FOAD.
PLONK
Osmo said:In fact, TL's response was not only civil, but also cordial.
RTFM.
Your being an anonymous/nicknamed,
Groups, clueless newbie, nothing more was to be expected. FOAD.
Osmo said:optimistx kirjoitti:
There's a clue for you too.
That was another message, a response to an undeserved and unjust
personal attack.
Hi,
I came across this line of code in a book. It appears to use the
alternative if syntax, but it doesn't quite make sense to me:
res += (i * j) % 8 ? " " : "*";
where res is a string variable, and i and j are number variables (i
increments from 1 to 7 and j increments from 1 to 15).
What's confusing me is that I thought the expression preceding the ?
had to be a conditional (i.e., true or false) statement in order for
the computer to choose between " " and "*". But (i * j) % 8 isn't a
conditional. It just evaluates to a number. So how is the choice made
between " " and "*"?
Thank you,
Cute, and getting cuter...Jorge said:The truly "alternative" if syntax is
res += ( ((i * j) % 8) && " " ) || "*";
Cute, and getting cuter...
Hey Jorge, set up a call table in an array
Better, but no bananaJorge said:Cute, and getting cuter...
Hey Jorge, set up a call table in an array
Yeah ! You're right ! I forgot that one !
a= [" ", "*"];
res+= a[!((i * j) % 8)];
Yeah ! You're right ! I forgot that one !a= [" ", "*"];
res+= a[!((i * j) % 8)];
Better, but no banana
given
function return_star()
{
return "*";}
f8uncton return_blamk()
{
return " ";
}
now set up an array and a function that calls the correct one by
indexing off an array.
Better, but no bananaJorge said:On Oct 20, 10:40 pm, The Natural Philosopher <[email protected]>
wrote:
Jorge wrote:
The truly "alternative" if syntax is
res += ( ((i * j) % 8) && " " ) || "*";
Cute, and getting cuter...
Hey Jorge, set up a call table in an array
Yeah ! You're right ! I forgot that one !
a= [" ", "*"];
res+= a[!((i * j) % 8)];
given
function return_star()
{
return "*";}
f8uncton return_blamk()
{
return " ";
}
now set up an array and a function that calls the correct one by
indexing off an array.
That's the same as above, just put functions into the array to have
them called afterwards:
a= [fBlank, fStar];
res+= a[!((i * j) % 8)]();
optimistx kirjoitti:
What exactly was so "unfriendly" or "crude" as the OP put it? I could
not have responded more civilly even if I had three weeks to practice.
In fact, TL's response was not only civil, but also cordial. Go ahead,
read it, parse it and get the correct returned value.
Your being an anonymous/nicknamed, Google
Groups, clueless newbie, nothing more was to be expected. FOAD.
PLONK
optimistx kirjoitti:
What is wrong with reading the fine manual?
^^^^^^^^^^^^^^^^^^^^^^^^^Let me quote the whole
context to make it clear:
"You're welcome, but please read the FAQ now, and ultimately RTFM."
^^^^^^^ ^^^^^^
The "you are welcome" is a polite response to a thanks. Please is a
civil request showing regard for others.
I'd say that all the
bitterness, sourness and unfriendliness of the above tone is in the
touchy eye of the beholder.
As the saying goes: ingratitude is the world's wage.
Le 10/20/09 11:05 PM, Jorge a écrit :
Jorge wrote:
On Oct 20, 10:40 pm, The Natural Philosopher <[email protected]>
wrote:
Jorge wrote:
The truly "alternative" if syntax is
res += ( ((i * j) % 8) && " " ) || "*";
Cute, and getting cuter...
Hey Jorge, set up a call table in an array
Yeah ! You're right ! I forgot that one !
a= [" ", "*"];
res+= a[!((i * j) % 8)];
--
Jorge.
Better, but no banana
given
function return_star()
{
return "*";}
f8uncton return_blamk()
{
return " ";
}
now set up an array and a function that calls the correct one by
indexing off an array.That's the same as above, just put functions into the array to have
them called afterwards:a= [fBlank, fStar];
res+= a[!((i * j) % 8)]();
? ? ?
javascript:b=function(){return'blank'};c=function(){return'star'};a=[b,c];a lert(a[!(250.23*2)%8]());
javascript:b=function(){return'blank'};c=function(){return'star'};a=[b,c];a lert(a[!('z'*2)%8]());
javascript:b=function(){return'blank'};c=function(){return'star'};a=[b,c];a lert((250.23*2)%8);alert(!((250.23*2)%8));alert(a[!((250.23*2)%8)]());
Don't give me your bullshit spin. Nice substitution on the "f" there.
Here's an interesting quote from the Ubuntu forums:
Simply, he made the OP (which may or may not be myself
graderex meinte:
Don't give me your bullshit spin. Nice substitution on the "f" there.
Here's an interesting quote from the Ubuntu forums:
[snip]
Who cares? This is *usenet*, not some ubuntu forum.
Gregor
graderex meinte:
What's this nymshifting good for - except that you look like a full
blown troll now? The alt.* groups are elsewhere.
Gregor
--http://www.gregorkofler.com
graderex meinte:
[snip]optimistx kirjoitti:
What is wrong with reading the fine manual?
Don't give me your bullshit spin. Nice substitution on the "f" there.
Here's an interesting quote from the Ubuntu forums:
Who cares? This is *usenet*, not some ubuntu forum.
Gregor
Oh, so if you're a *usenet* person, then it's OK to behave like an
uncivilized a-hole? Ah ha, thanks for setting me straight.
Tue said:It doesn't take long for people to figure out how unfriendly
PointedEars is. It's weird isn't it, if he only knew how to communicate
in a friendly manner he might well become a hero around here. Instead
though, despite his obvious knowledge, he makes enemies here every day.
Jorge said:Le 10/20/09 11:05 PM, Jorge a écrit :
? ? ?On Oct 20, 10:55 pm, The Natural Philosopher <[email protected]>
wrote:
Jorge wrote:
On Oct 20, 10:40 pm, The Natural Philosopher <[email protected]>
wrote:
Jorge wrote:
The truly "alternative" if syntax is
res += ( ((i * j) % 8) && " " ) || "*";
Cute, and getting cuter...
Hey Jorge, set up a call table in an array
Yeah ! You're right ! I forgot that one !
a= [" ", "*"];
res+= a[!((i * j) % 8)];
--
Jorge.
Better, but no banana
given
function return_star()
{
return "*";}
f8uncton return_blamk()
{
return " ";
}
now set up an array and a function that calls the correct one by
indexing off an array.
That's the same as above, just put functions into the array to have
them called afterwards:
a= [fBlank, fStar];
res+= a[!((i * j) % 8)]();
javascript:b=function(){return'blank'};c=function(){return'star'};a=[b,c];a lert(a[!(250.23*2)%8]());
javascript:b=function(){return'blank'};c=function(){return'star'};a=[b,c];a lert(a[!('z'*2)%8]());
javascript:b=function(){return'blank'};c=function(){return'star'};a=[b,c];a lert((250.23*2)%8);alert(!((250.23*2)%8));alert(a[!((250.23*2)%8)]());
Oh yes, I see, a + is needed in front of the !...
b=function(){return'blank'};
c=function(){return'star'};
a=[b,c];
alert(a[+!(((250.23*2))%8)]());
alert(a[+!((64*27)%8)]());
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.