'How can I compile atom code through terminal using truffle?

I trying to compile my atom code through the Mac terminal and I received this error:

Error parsing /Users/owner/Desktop/contracts/contracts/ApprovalContracts.sol: ParsedContract.sol:6:36: ParserError: Expected primary expression.
address public constant approver = ;                  ^
Compilation failed. See above.

I need to compile my code from atom using the terminal truffle compile.

Here is the code:

pragma solidity ^0.4.18;

contract ApprovalContracts {

address public sender;
address public receiver;
address public constant approver =;

function deposit(address _receiver) external payable {
 require(msg.value > 0);
 sender = msg.sender;
 receiver = receiver;
}

function viewApprover() external pure return(address)  {
return(approver);
}

function approve() external {
require(msg.sender == approver);
receiver.transfer(address(this).balance);
}
}

enter image description here

enter image description here



Solution 1:[1]

There are a few problems with your code.

  1. You have to initialize the constant variable approver with a value.
  2. On line 12, the code should be receiver = _receiver;
  3. On line 15, it should be returns(address) instead of return(address)

The final code should be something like this

pragma solidity ^0.4.18;

contract ApprovalContracts {

    address public sender;
    address public receiver;
    address public constant approver=some-address-here-without-quotes;

    function deposit(address _receiver) external payable {
        require(msg.value > 0);
        sender = msg.sender;
        receiver = _receiver;
    }

    function viewApprover() external pure returns(address) {
        return(approver);
    }

    function approve() external {
        require(msg.sender == approver);
        receiver.transfer(address(this).balance);
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1