首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我在实心课程上过得很艰难

我在实心课程上过得很艰难
EN

Stack Overflow用户
提问于 2020-07-19 00:39:09
回答 3查看 108关注 0票数 0

我是stackowerflow的新手,也是可靠的新手。

我必须这样做:在函数booleanOperatorTest中,对变量foo求反,并将结果赋给变量negation

代码语言:javascript
复制
pragma solidity ^0.4.17;

contract OperatorTutorial {

    function booleanOperatorTest(bool foo, bool bar) public pure
        returns (bool negation, bool conjunction, bool disjunction, bool equality, bool inequality) {

        // Negate the variable "foo" and assign the result to variable "negation"
        // negation =
}

我试了所有的方法,但我不能通过这一步,请帮助,谢谢。

EN

回答 3

Stack Overflow用户

发布于 2020-07-20 04:15:15

示例函数:

代码语言:javascript
复制
function booleanOperatorTest(bool foo, bool bar) public pure
    returns (bool negation,bool conjunction) {

    // Negate the variable "foo" and assign the result to variable "negation"
      negation =foo;
      conjunction  = (foo && bar);
      ...

}
票数 0
EN

Stack Overflow用户

发布于 2020-07-20 06:53:29

代码语言:javascript
复制
pragma solidity ^0.4.17;

contract OperatorTutorial {

    function booleanOperatorTest(bool foo, bool bar) public pure
        returns (bool negation, bool conjunction, bool disjunction, bool equality, bool inequality) {
        negation = !foo;
 }

感谢Mert Sungur

票数 0
EN

Stack Overflow用户

发布于 2021-07-02 21:30:09

代码语言:javascript
复制
pragma solidity ^0.4.17;

contract OperatorTutorial {

    function booleanOperatorTest(bool foo, bool bar) public pure
        returns (bool negation, bool conjunction, bool disjunction, bool equality, bool inequality) {

        // Negate the variable "foo" and assign the result to variable "negation"
        // negation =
           negation = !foo;
        // Use logical "and" on variables "foo" and "bar" and assign the result to variable "conjunction"
        // conjunction =
           conjunction  = (foo && bar);
        // Use logical "or" on variables "foo" and "bar" and assign the result to variable "disjunction"
        // disjunction =
           disjunction = (foo || bar);
        // Make sure variable "equality" is true when "foo" and "bar" are equal and is false otherwise.
        // equality =
           equality = (foo  == bar);
        // Make sure variable "inequality" is true when "foo" and "bar" are not equal and is false otherwise.
        // inequality =
           inequality = (foo != bar);
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62971049

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档