Defined function (traditional): Difference between revisions

Jump to navigation Jump to search
m (Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com")
Line 4: Line 4:


== Examples ==
== Examples ==
[[Ambivalent function]] with optional left argument and one local variable (Dyalog APL):
[[Ambivalent function]] with an optional left argument, a conditional [[control structure]] and one local variable (Dyalog APL):
<source lang=apl>
<source lang=apl>
∇ res←{left} AddMult2 right;local
∇ res←{left} AddMult2 right;local
   :If 0=⎕NC'left'
   :If 0=⎕NC'left'     if variable "left" is not defined already
      left←0      define variable "left" with value 0 if it's not defined already
      left←0
   :EndIf
   :EndIf
   local←left+right
   local←left+right
trusted
69

edits

Navigation menu