Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Swift Check if an Array is Empty

// array with elements
let numbers = [21, 33, 59, 17]
print("Numbers: (numbers)")

// check if numbers is empty
var  result = numbers.isEmpty
print("Is numbers empty? : (result)")

// array without elements
let evenNumbers = [Int]()
print("Even Numbers: (evenNumbers)")

// check if evenNumbers is empty
result = evenNumbers.isEmpty
print("Is evenNumbers empty? : (result)")
Comment

PREVIOUS NEXT
Code Example
Swift :: declare empty dictionary in swift 
Swift :: how to know when text changed textfield swiftui 
Swift :: sizetofit not working swift 
Swift :: underline text in storyboard xcode 
Swift :: how to delete from list tvos swiftui coredata 
Ruby :: kill rails 
Ruby :: ruby array group by attribute 
Ruby :: rails resources except 
Ruby :: rails benchmark 
Ruby :: devise add trackable 
Ruby :: rails status migrations 
Ruby :: ruby replace certain character 
Ruby :: rspec add support folder to gem 
Ruby :: create rails project with postgres 
Ruby :: ruby trim spaces 
Ruby :: merge two lists together ruby 
Ruby :: rails g migration add column array 
Ruby :: how to write CSV file in rails 
Ruby :: rails link to 
Ruby :: attr_accessor ruby 
Ruby :: ruby while loops 
Ruby :: rails helper in controller 
Ruby :: ruby each 
Ruby :: selenium webdriver get attribute ruby 
Ruby :: ruby attr_writer example 
Ruby :: rails array pop first n elements 
Ruby :: force stop rails server 
Ruby :: run method before rails 
Ruby :: ruby block_given? method 
Ruby :: ruby array serach 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =