5326c90e-1068-49fb-ad6d-4f4e0062cbed
prompter
Please write an algebraic circuit in Circom that takes one input and outputs 2*input.
92131b13-8c3c-4088-900e-fdc35257938b
5326c90e-1068-49fb-ad6d-4f4e0062cbed
assistant
This is a basic circuit that computes `input` multiplied by 2:
```
pragma circom 2.0.0;

template Multiplier2(){
   //Declaration of signals
   signal input in1;
   signal output out <== in1 * 2;
}

component main {public [in1]} = Multiplier2();
```
If you are working with Circom version before 2.0.4 then you can't initialize signals right after decleration and would have to split the line in two, as follows:
```
pragma circom 2.0.0;

template Multiplier2(){
   //Declaration of signals
   signal input in1;
   signal output out;
   out <== in1 * 2;
}

component main {public [in1]} = Multiplier2();
```
8ac688d6-6f38-4d8b-9c86-8643c7fac00e
92131b13-8c3c-4088-900e-fdc35257938b
prompter
Can you explain how the first one works line-by-line.