[Question]
  [
Your task is simple: given two integers \$a\$ and \$b\$, output \$\Pi[a,b]\$; that is, the product of the range between \$a\$ and \$b\$. You may take \$a\$ and \$b\$ in any reasonable format, whether that be arguments to a function, a list input, STDIN, et cetera. You may output in any reasonable format, such as a return value (for functions) or STDOUT. \$a\$ will always be less than \$b\$.
Note that the end may be exclusive or inclusive of \$b\$. I'm not picky. ^\_^
## Test cases
```
[a,b) => result
[2,5) => 24
[5,10) => 15120
[-4,3) => 0
[0,3) => 0
[-4,0) => 24
[a,b] => result
[2,5] => 120
[5,10] => 151200
[-4,3] => 0
[0,3] => 0
[-4,-1] => 24
```
---
This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest program in bytes wins.
---
## Leaderboard
The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
```
## Language Name, N bytes
```
where `N` is the size of your submission. If you improve your score, you *can* keep old scores in the headline, by striking them through. For instance:
```
## Ruby, <s>104</s> <s>101</s> 96 bytes
```
If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the *last* number in the header:
```
## Perl, 43 + 2 (-p flag) = 45 bytes
```
You can also make the language name a link which will then show up in the snippet:
```
## [><>](http://esolangs.org/wiki/Fish), 121 bytes
```
```
var QUESTION_ID=66202,OVERRIDE_USER=44713;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
```
```
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
```
  
[Answer]
# Jelly, 2 bytes
```
rP
```
Takes two numbers as command line arguments. [Try it online.](http://jelly.tryitonline.net/#code=clA&input=&args=MQ+NQ)
Note that this is inclusive range. For the cost of a byte (3 bytes), we can make this exclusive:
```
’rP
```
[Try it online.](http://jelly.tryitonline.net/#code=4oCZclA&input=&args=NQ+MQ) Note that the arguments must be given in the order `b a` for this version.
## Explanation
### Inclusive
```
a rP b
  r   dyadic atom, creates inclusive range between a and b
   P  computes product of the list
```
### Exclusive
```
b ’rP a
  ’   decrement b (by default, monadic atoms in dyadic chains operate on the left argument)
   r  range
    P product 
```
[Answer]
## [ArnoldC](https://esolangs.org/wiki/ArnoldC), ~~522~~ 511 bytes
First post on codegolf !
I had fun doing this.
Exclusive range.
```
LISTEN TO ME VERY CAREFULLY f
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE a
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE b
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE r
YOU SET US UP 1
HEY CHRISTMAS TREE l
YOU SET US UP 1
STICK AROUND l
GET TO THE CHOPPER r
HERE IS MY INVITATION r
YOU'RE FIRED a
ENOUGH TALK
GET TO THE CHOPPER a
HERE IS MY INVITATION a
GET UP 1
ENOUGH TALK
GET TO THE CHOPPER l
HERE IS MY INVITATION b
LET OFF SOME STEAM BENNET a
ENOUGH TALK
CHILL
I'LL BE BACK r
HASTA LA VISTA, BABY
```
Explanations (Thanks Bijan):
```
DeclareMethod f
        MethodArguments a
        MethodArguments b
        NonVoidMethod
        DeclareInt r
        SetInitialValue 1
        DeclareInt l
        SetInitialValue 1
        WHILE l
                AssignVariable r
                        SetValue r
                        MultiplicationOperator a
                EndAssignVariable
                AssignVariable a
                        SetValue a
                        + 1
                EndAssignVariable
                AssignVariable l
                        SetValue b
                        > a
                EndAssignVariable
        EndWhile
        Return r
EndMethodDeclaration
```
[Answer]
## Python, 30 bytes
```
f=lambda a,b:a>b or a*f(a+1,b)
```
Inclusive range. Repeatedly multiplies by and increments the left endpoint, until it is higher than the right endpoint, in which case it's the empty product of 1 (as True).
[Answer]
## Minecraft 15w35a+, program size 456 total (see below)
[![enter image description here](https://i.stack.imgur.com/i1QUG.png)](https://i.stack.imgur.com/i1QUG.png)
This calculates `PI [a,b)`. Input is given by using these two commands: `/scoreboard players set A A {num}` and `/scoreboard players set B A {num}`. Remember to use `/scoreboard objectives add A dummy` before input.
Scored using: `{program size} + ( 2 * {input command} ) + {scoreboard command} = 356 + ( 2 * 33 ) + 34 = 456`.
This code corresponds to the following psuedocode:
```
R = 1
loop:
  R *= A
  A += 1
  if A == B:
    print R
    end program
```
Download the world [here](http://www.mediafire.com/download/uapxuk2ppror5ms/PPCG__Product_over_a_Range.zip).
[Answer]
## TI-BASIC, 9 bytes
```
Input A
prod(randIntNoRep(A,Ans
```
Takes one number from `Ans` and another from a prompt.
Also 9 bytes, taking input as a list from `Ans`:
```
prod(randIntNoRep(min(Ans),max(Ans
```
[Answer]
## Python 2, ~~44~~ 38 bytes
```
lambda l:reduce(int.__mul__,range(*l))
```
Pretty much the obvious anonymous function answer.
EDIT: Thanks to xnor for saving 6 bytes with some features I didn't know.
[Answer]
## Pyth, 5 bytes
```
*FrQE
```
Pyth doesn't have product, so we reduce \* over the range.
Uses exclusive range.
[Answer]
# R, 22 bytes
```
function(a,b)prod(a:b)
```
[Answer]
# Mathematica, 15 bytes
```
1##&@@Range@##&
```
A shorter solution that only works for non-negative integers:
```
#2!/(#-1)!&
```
[Answer]
# JavaScript (ES6), 34 bytes
```
(a,b)=>eval("for(c=a;a<b;)c*=++a")
```
Sometimes the simplest answer is the best! Just a `for` loop inside `eval`. Inclusive range.
[Answer]
# [Japt](https://github.com/ETHproductions/Japt), 7 bytes
Easy challenges like this are always fun. :)
```
UoV r*1
```
[Try it online!](http://ethproductions.github.io/japt?v=master&code=VW9WIHIqMQ==&input=NSAxMA==)
### Explanation
```
UoV r*1  // Implicit: U = first input, V = second input
UoV      // Generate range [U,V).
    r*1  // Reduce by multiplication, starting at 1.
```
Wow, this seems pathetic compared to the other answers so far. I need to work on Japt some more...
[Answer]
## Seriously, 4 bytes
```
,ixπ
,         Read list [a,b] from stdin
 i        Flatten it to a b
  x       Pop a,b, push range(a,b)
   π      Pop the list and push its product.
```
Hex Dump:
```
2c6978e3
```
[Try it online](http://seriouslylang.herokuapp.com/link/code=2c6978e3&input=[3,6])
[Answer]
# Prolog, 45 bytes
**Code:**
```
p(A,B,C):-A=B,C=A;D is A+1,p(D,B,E),C is A*E.
```
**Explained:**
```
p(A,B,C):-A=B,      % A is unifiable with B
          C=A       % Unify C with A
          ;         % OR
          D is A+1, % D is the next number in the range
          p(D,B,E), % Recurse on the range after the first element
          C is A*E. % The result C is the product of the first element and the result 
                      of the recursion
```
**Example:**
```
p(5,10,X).
X = 151200
p(-4,-1,X).
X = 24
```
[Answer]
## Octave, 15 bytes
```
@(a,b)prod(a:b)
```
Straightforward. Uses the inclusive range.
[Answer]
## CJam, ~~6~~ ~~19~~ ~~18~~  10 bytes
Thanks to Dennis and RetoKoradi for help with golfing!
```
q~1$-,f+:*
```
[Try it online](http://cjam.aditsu.net/#code=q%7E1%24-%2Cf%2B%3A*&input=2%205)
Takes input as `a b`. Calculates `PI [a,b)`.
*Note: this program is 6 bytes long, and only works if `a` and `b` are positive.*
```
q~,>:*
```
[Try it online](http://cjam.aditsu.net/#code=q%7E%2C%3E%3A*&input=2%205)
Takes input as `a b`. Calculates `PI [a,b)`.
[Answer]
## Haskell, ~~19~~ 17 bytes
```
a#b=product[a..b]
```
Usage example: `2#5`-> `120`.
[Answer]
# Julia, 16 bytes
```
f(a,b)=prod(a:b)
```
Note: if the range object `a:b` (which is literally stored as a start value and a stop value, and internally includes a "increment by 1 on each step" value) is permitted as the input, then just 4 bytes are required: `prod`.
[Answer]
# C, 32 bytes
For `[a,b)`:
```
f(a,b){return a-b?a*f(a+1,b):1;}
```
For `[a,b]` (On Katenkyo's suggestions, 32 bytes again) :
```
f(a,b){return a<b?a*f(a+1,b):b;}
```
[Answer]
# Bash + GNU utilities, 13
```
seq -s* $@|bc
```
Assumes there are no files in the current directory whose names start with `-s`. Start and end (inclusive) are passed as command-line parameters.
This simply produces the sequence from start to end, separated by `*`, then pipes to `bc` for arithmetic evaluation.
[Answer]
## JavaScript (ES6), 22 bytes
I can't believe none of us JS golfers thought to use recursion...
```
a=>F=b=>a-b?b*F(b-1):a
```
Assign to a variable with e.g. `var q = a=>F=b=>a-b?b*F(b-1):a`, then call like `q(2)(5)`.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 3 bytes
```
⟦₃×
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/qG3Do6bG04vK/z@av@xRU/Ph6f//R0cb6ZjG6kSb6hgaAKl4Ex1jIGUAJoEcg9hYAA "Brachylog – Try It Online")
Input is passed as `[A,B]`. The range is exclusive of B, but could be made inclusive by replacing the `₃` with `₂`.
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 4 bytes
Inclusive Range
```
2$:p
```
[**Try it online!**](http://matl.tryitonline.net/#code=MiQ6cA&input=Mgo1)
### Explanation
```
2$: % Implicitly grab two input arguments and create the array input1:input2
p   % Take the product of all array elements
```
Thanks to [@Don Muesli](https://codegolf.stackexchange.com/users/36398/don-muesli) for helping me get the hang of this whole MATL thing.
[Answer]
# [Jolf](https://github.com/ConorOBrien-Foxx/Jolf), 4 bytes
[Try it here!](http://conorobrien-foxx.github.io/Jolf/#code=T3JqSg)
```
OrjJ
  jJ two inputs
 r   range between them [j,J)
O    product
```
[Answer]
# Ruby, 22 bytes
```
->i,n{(i..n).reduce:*}
```
**Ungolfed:**
```
-> i,n {
  (i..n).reduce:* # Product of a range
}
```
**Usage:**
```
->i,n{(i..n).reduce:*}[5,10]
=> 151200
```
[Answer]
## PowerShell, 30 Bytes
```
param($a,$b)$a..$b-join'*'|iex
```
Takes input as two integers, creates a range with `..`, then `-join`s that with asterisks, pipes it into `Invoke-Expression` (similar to `eval`). The range operator in PowerShell is inclusive.
Pretty competitive with non-golfing languages.
[Answer]
# J, 8 bytes
```
[:%/!@<:
```
### Usage
```
>> f =: [:%/!@<:
>> f 10 5
<< 15120
```
where `>>` is STDIN and `<<` is STDOUT.
### Explanation
It computes `∏[a,b]` as `(b-1)!/(a-1)!`.
```
minus_one =: <:
factorial =: !
of        =: @
monadic   =: [:
division  =: %/
f =: monadic division factorial of minus_one
```
## Previous 13-byte version
Written when I had no idea what `J` even is :p
```
*/(}.[:>:i.)/
```
Usage:
```
   */(}.[:>:i.)/ 5 10
30240
```
Explanation:
```
*/            NB. multiply over
  (
   }.         NB. remove [the first x items] from
     [:>:     NB. increment all of
         i.   NB. the numbers from 0 to [y-1]
           )
            / NB. insert the above code into the following numbers
```
Detailed explanation:
```
i.10 would produce 0 1 2 3 4 5 6 7 8 9
>:i.10 would make it 1 2 3 4 5 6 6 7 8 9 10
the [: is used to make the ">:" take only one argument (a monad)
because if it takes two arguments, it is a different function.
so [:>:i.10 becomes 1 2 3 4 5 6 7 8 9 10
}. means take away the first [x] items from the following list,
so 5}.1 2 3 4 5 6 7 8 9 10 becomes 6 7 8 9 10
the two slashes "/" in the code are actually the same
for example, */6 7 8 9 10 becomes 6*7*8*9*10
```
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), ~~8~~ 3 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
```
×/…
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn///B0/UcNy/6nPWqb8Ki371HfVE//R13Nh9YbP2qbCOQFBzkDyRAPz@D/RgppCqZcpkDS0IDr0HoTIMOYywBMQniH1hsCAA "APL (Dyalog Extended) – Try It Online")
`…` range
`×/` multiplication across
This is an "atop" so `a(×/…)b` is `×/a…b`.
[Answer]
# [R](https://www.r-project.org/), 21 bytes
*Thanks to [Dominic van Essen](https://codegolf.stackexchange.com/users/95126) for [helping me brainstorm input methods](https://chat.stackexchange.com/transcript/message/55468258#55468258).*
```
prod((a=scan()):a[2])
```
Uses inclusive range. [Try it online!](https://tio.run/##K/r/v6AoP0VDI9G2ODkxT0NT0yox2ihW878Rl@l/AA "R – Try It Online")
### Explanation
```
      a=scan()         Read the two inputs as a vector and assign it to a
     (        ):       Use a as the lower end of a range (R interprets this as "use the
                        first element of the vector" by default)
                a[2]   Use the second element of a as the upper end of the range
prod(               )  Take the product of all numbers in the range
```
[Answer]
# [Desmos](https://www.desmos.com), 19 bytes
```
f(a,b)=∏_{n=a}^bn
```
[Try it on Desmos!](https://www.desmos.com/calculator/iqtrnjbvwn)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
Code:
```
ŸP
```
Explanation:
```
Ÿ   # Inclusive range [input, ..., input]
 P  # Total product of the list
    # Implicit printing top of the stack
```
]