Anonymous user
Empty string: Difference between revisions
→{{header|Nyquist}}: syntax variations
Childishbeat (talk | contribs) m (Nyquist has been added.) |
(→{{header|Nyquist}}: syntax variations) |
||
Line 1,446:
=={{header|Nyquist}}==
===Lisp Syntax===
<lang
(setf emptystring "") ;binds variable'emptystring' to the empty string ""
;version 1▼
(let ((emptystring "")) ;; Binds local variable 'emptystring' to the empty string ""
(when (string-equal emptystring "") ;;case insensitive string comparison
(print "Is an empty string")) ;;bad argument error if not a string
(when (stringp emptystring)
(when (not (stringp emptystring))
(print "Is not a string"))
(when (and (stringp emptystring)(= (length emptystring) 0))
(print "Is an empty string"))
(when (and (stringp emptystring)(> (length emptystring) 0))
(print "Is a non-empty string")))
</lang>
===SAL Syntax===
<lang sal>
define variable emptystring = "" ;binds variable'emptystring' to the empty string ""
print "is empty string"
else▼
print "is not empty string"
</lang>
===Audacity plug-in (LISP syntax)===
<lang lisp>
;nyquist plug-in
;type tool
;name "Empty string"
(setq emptystring "") ;; Define global variable
▲if string = "" then
(if (string= emptystring "") ;;case sensitive string comparison
"The string is not empty.")
</lang>
▲else
▲ print "The string isn't empty."
===Audacity plug-in (SAL syntax)===
;nyquist plug-in
;version 4
;codetype sal
;type tool
;name "Empty string"
define variable emptystring = "a" ;; Define global variable
;; The ternary operator is #?
return #?(emptystring = "",
"The string is empty.",
"The string is not empty.")
</lang>
=={{header|oberon-2}}==
|