Difference between revisions of "IsEmpty"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "Pretty self explanatory, this method returns a bool indicating whether the queue instance has any values or not.")
 
Line 1: Line 1:
 +
<syntaxhighlight lang=csharp>
 +
            public bool IsEmpty()
 +
            {
 +
                if (this.Rear == -1)
 +
                {
 +
                    return true;
 +
                }
 +
                else
 +
                {
 +
                    return false;
 +
                }
 +
            }
 +
</syntaxhighlight>
 +
 
Pretty self explanatory, this method returns a bool indicating whether the queue instance has any values or not.
 
Pretty self explanatory, this method returns a bool indicating whether the queue instance has any values or not.

Revision as of 12:42, 14 November 2017

            public bool IsEmpty()
            {
                if (this.Rear == -1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

Pretty self explanatory, this method returns a bool indicating whether the queue instance has any values or not.