Empty string: Difference between revisions
Content added Content deleted
(add language: Retro) |
(add scala) |
||
Line 372: | Line 372: | ||
Note that we can '''not''' do the following, because the empty string is equivalent to true in Ruby ([[Boolean values#Ruby]]): |
Note that we can '''not''' do the following, because the empty string is equivalent to true in Ruby ([[Boolean values#Ruby]]): |
||
<lang ruby>if s then puts "not empty" end</lang> |
<lang ruby>if s then puts "not empty" end</lang> |
||
=={{header|Scala}}== |
|||
<lang scala>// assign empty string to a variable |
|||
val s="" |
|||
// check that string is empty |
|||
s.isEmpty // true |
|||
s=="" // true |
|||
s.size==0 // true |
|||
// check that string is not empty |
|||
s.nonEmpty // false |
|||
s!="" // false |
|||
s.size>0 // false</lang> |
|||
=={{header|Seed7}}== |
=={{header|Seed7}}== |