What does a double * (splat) operator do

Have you seen a function declared like this?

def foo a, **b
  ...
end

I understand that a single * is the splat operator. What does ** mean?

Score: 221
Tags: ruby, splat
Views: 58221
Date posted: 8/17/2013

What does the double exclamation !! operator mean?

Possible Duplicate:
What is the !! operator in JavaScript?
What does !! (double exclamation point) mean?

I am going through some custom JavaScript code at my workplace and I am not able to understand the following construct.

var myThemeKey = (!!$('row') && $('row').hasClassName('green-theme')) ? 'green' : 'white';

I understand everything on the above line except !! operator. I assume that it is a NOT operator and NOT of NOT is the original value but why would someone do a NOT of NOT?

Can someone please help me understand what is happening on the above line of code?

Score: 78
Tags: javascript
Views: 52944
Date posted: 9/17/2011

What does the ** maths operator do in Python?

What does this mean in Python:

sock.recvfrom(2**16)

I know what sock is, and I get the gist of the recvfrom function, but what the heck is 2**16? Specifically, the two asterisk/double asterisk operator?


(english keywords, because it's hard to search for this: times-times star-star asterisk-asterisk double-times double-star double-asterisk operator)

Score: 36
Tags: python, syntax, operators
Views: 37334
Date posted: 11/5/2009

What does ~~ do in JavaScript/node.js?

Possible Duplicate:
What is the “double tilde” (~~) operator in JavaScript?

I found this snip of code in a node.js library's source. What effect does ~~ have on the input variable?

inArray[3] = ~~input;

It's also used in other ways:

return ~~ ((a - b) / 864e5 / 7 + 1.5);
Score: 10
Tags: javascript, node.js
Views: 2583
Date posted: 4/10/2012

What does '=>' do in C#?

Possible Duplicates:
Lamda Explanation and what it is as well as a good example
What is the => token called?

I have seen this code:

myContext.SomeEntities.Single(x => x.code == code);  

And I don´t know what does the => operator do.

Every search on google about the operator returns no results.

Thank you.

Score: 5
Tags: c#, operators
Views: 1254
Date posted: 6/21/2011


1


© 2021 Search Overflow
Contributions licensed under cc by-sa