I am new to powershell scripting. I am supposed to check to see if the first parameter passed is a string and second parameter is an int.
function positions {
param (
[string] $inputstring,
[int] $num )
}
$inputstring=read-host "Enter your name"
if ( !$inputstring -eq "" ) {
Write-Output "The first recieved parameter is: " $inputstring "and its type is a string"}
else { Write-Output "The first received parameter is:" $inputstring "and its type is not a string" }
$num=read-Host "Enter a number"
if ( $num -eq int ) {
Write-Output "This second parameter is" $num "and its type is a integer"}
else { Write-Output "This second parameter is" $num "and its type is not a integer"}
I believe the if statement for the string is wrong because it give me right input only if i negate it with '!'
Also, for the int, if statement it is not reading 'int' after -eq.
I am extremely new to this so need help.