So I'm having an issue with a script snip.
This line
if ($2 = null) {$2 = 6}
I'm using a wrong variable. The idea is if no other number is set for $2 I want $2 to equal 6. Otherwise, it's the number set in the script command.
Use this:
if ($2 == $null) { var %2 = 6 }
And you get 6 when $2 is 0
Never use $iif unless speed execution doesn't matter and it really avoids repetition
I like Sakana's idea
var %2 = $2
if (%2 == $null) %2 = 6
Yeah but you are still using $iif, the suggestion was to never suggest to someone to use $iif unless speed execution doesn't matter AND it makes the code clearer/avoids repetition, because $iif is much much slower than /if
On the same lines as this, if I want a different variable set if letters and not numbers are used, how would I do that?
I'm looking for the variable segment that states that, but I cannot find it.
As in..
if $2 is a word or series of words and not a number then.. the script does another thing...
Looking for the variable that means "no numbers included, only the alphabet"
You need a regular expression. This one does what you want (only triggers if all characters in $2- are either letters or spaces)
if $regex($2-,/^([A-Za-z\s]*)$/g) { echo -a $regml(1) }