Basic Examples 
(3)
 

Initialize a symbol:
In[1]:=
[◼]
SetUnless
[x,1,IntegerQ]
Out[1]=
1
The value is not set if it already satisfies the given criteria:
In[2]:=
[◼]
SetUnless
[x,2,IntegerQ]
Out[2]=
1
In[3]:=
x
Out[3]=
1
———
The
expr
does not need to be a symbol:
In[1]:=
[◼]
SetUnless
[f[1],Pi,NumericQ]
Out[1]=
π
In[2]:=
[◼]
SetUnless
[f[1],E,NumericQ]
Out[2]=
π
In[3]:=
f[1]
Out[3]=
π
———
Use the operator forms:
In[1]:=
[◼]
SetUnless
[StringQ][a,"hello"]
Out[1]=
hello
In[2]:=
[◼]
SetUnless
[StringQ][a,"world"]
Out[2]=
hello
In[3]:=
a
Out[3]=
hello
In[4]:=
[◼]
SetUnless
[123,IntegerQ][b]
Out[4]=
123
In[5]:=
[◼]
SetUnless
[456,IntegerQ][b]
Out[5]=
123
In[6]:=
b
Out[6]=
123
In[7]:=
[◼]
SetUnless
[ListQ][{1,2,3}][c]
Out[7]=
{1,2,3}
In[8]:=
[◼]
SetUnless
[ListQ][{4,5,6}][c]
Out[8]=
{1,2,3}
In[9]:=
c
Out[9]=
{1,2,3}

Scope 
(2)
 


Applications 
(2)
 


Properties and Relations 
(2)
 
