Since Inco enables smart contracts to compute over private data without leaking any information, two common programming usages can’t be used.Documentation Index
Fetch the complete documentation index at: https://docs.inco.org/llms.txt
Use this file to discover all available pages before exploring further.
- You can’t use an if/else statement with a condition depending on a private value. The flow that the program would take would leak information about the private value.
- For the same reason you can’t revert a transaction based on a condition depending on a private value.
Multiplexer Design Pattern
The inco equivalent of an if/else statement is theselect statement.
The select statement takes an encrypted boolean as first argument and two encrypted values as second and third arguments.
The result of the select statement is the second argument if the first argument is true and the third argument otherwise.
Example usage from the confidential token contract: