1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Answered Help with functions

Discussion in 'Call of Duty: Black Ops 3 Answered Questions' started by Aspire, Nov 18, 2016.

  1. Aspire

    Aspire Active Member

    31
    14
    8
    Credits:
    48
    I've seen functions like this and don't really know what they mean:
    Code:
    function test(bool = true)
    {
        if(bool == true)
        {
            self iPrintLn("True");
        }
        else
        {
            self iPrintLn("False");
        }
    }
    
     
  2. Cxwh

    Cxwh Active Member

    52
    31
    18
    Credits:
    1,145
    I think it would be the same as
    Code:
    function test(bool)
    {
        if(!isDefined(bool))
            bool = true;
    
        if(bool)
            self iPrintLn("True");
        else
            self iPrint("False");
    }
    
    So
    Code:
    function test(bool = true) //makes bool true if bool is undefined
     
    CabCon likes this.
  3. Patrick

    Patrick Guest

    Credits:
    0
    That should give you a syntax error but its basically just going to return a iprintLn depending if the variable is true or false.
     
  4. Aspire

    Aspire Active Member

    31
    14
    8
    Credits:
    48
    Why would it return anything? Can you explain it to me?
     
  5. SeriousHD-

    SeriousHD- Guest

    Credits:
    0
    It is Black Ops III. Syntax is valid. Stand down soldier
     
  6. Patrick

    Patrick Guest

    Credits:
    0
    Im sowwy.. you gotta remember im not a kewl dude who mods bo3 :cry:
     
  7. CabCon

    CabCon Head Administrator Staff Member

    2,773
    1,649
    113
    Credits:
    38,775
    @Aspire This exactly describe what it does :peace: :grinning: Good job @Cxwh!

    Question answered.
     
    Aspire likes this.

Share This Page