Can any one help me what is wrong in the below program. when i give 18,18 also this is giving as greater
function Is-Numeric ($Value) {
return $Value -match "^[\d\.]+$"
}
function comparevalues ($val1,$val2) {
Write-Host $val1,$val2
if (Is-Numeric($val1) -AND Is-Numeric($val2)) {
Write-Host $val1,$val2
if ($val1 -eq $val2) {
return "equal"
} ElseIF ($val1 -gt $val2) {
return "greater"
} Else {
return "lesser"
}
} Else {
return "notnumeric"
}
}
$val = comparevalues(18,18)
Write-Host $val
output of the program is as
18 18
18 18
greater
Please help me hwy the output is wrong.