Custom DSC Reource - Test not returning Bool

I have an issue with a Custom DSC I have written (my first attempt at such a thing - it just sets a wesite’s ID).

It is failing when I call it saying that “The PowerShell DSC resource returned results in a format that is not valid. The results from running Test-TargetResource must be the boolean value True or False.”

As far as I can see it is returning a bool - I have set verbose output which outputs:
VERBOSE: [L0611755]: [[LBGSetWebsiteID]SetID] WEBSITE DOES EXIST
VERBOSE: [L0611755]: [[LBGSetWebsiteID]SetID] Getting current ID
VERBOSE: [L0611755]: [[LBGSetWebsiteID]SetID] CURRENT ID = 999
VERBOSE: [L0611755]: [[LBGSetWebsiteID]SetID] CURRENT ID NOT THE SAME
VERBOSE: [L0611755]: LCM: [ End Test ] [[LBGSetWebsiteID]SetID] in 0.4120 seconds.
The PowerShell DSC resource returned results in a format that is not valid. The results from running
Test-TargetResource must be the boolean value True or False.

The last part of the code is:
if($currentID -eq $newID)
{
Write-Verbose “CURRENT ID IS THE SAME AS NEW ID”
Return $true
}
else
{
Write-Verbose “CURRENT ID NOT THE SAME”
Return $false
}

Any idea what I am doing wrong? As far as I can see this MUST be returning a bool… clearly I’ve messed up somewhere, but can’t see where.

Issue resolved. I had an errant variable in the code that wasn’t being set to anything. This caused the issue.