Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

Modifying Value Types from Method Swift

struct Employee {
  var salary = 0
  
  // define mutating function
  mutating func salaryIncrement(increase: Int) {

  // modify salary property  
  salary = salary + increase
  print("Increased Salary:",salary)
  }
}

var employee1 = Employee()
employee1.salary = 20000
employee1.salaryIncrement(increase: 5000)
Comment

Modifying Value Types from Method Swift

struct Employee {
  var salary = 0
  
  // define mutating function
  mutating func salaryIncrement(increase: Int) {

  // modify salary property  
  salary = salary + increase
  print("Increased Salary:",salary)
  }
}

var employee1 = Employee()
employee1.salary = 20000
employee1.salaryIncrement(increase: 5000)
Comment

PREVIOUS NEXT
Code Example
Swift :: swift go to main thread 
Swift :: Swift Use of Hash Function 
Swift :: Swift break with while Loop 
Swift :: Swift Add Two Numbers 
Swift :: Swift Add/Remove Elements From Tuple 
Swift :: declaration of array in swift by two methods. 
Swift :: UINavigationBar turns black 
Swift :: Swift Symmetric Difference between Two Sets 
Swift :: swift function 
Swift :: Swift Assigning and accessing a value from an optional 
Swift :: store multiple items in one core data record 
Swift :: Swift Library Function 
Swift :: xcode create image from calayer 
Swift :: Swift Check Subset of a Set 
Swift :: Create a Set in Swift 
Swift :: how to change the tint color of tab bar on storyboard swift 
Swift :: how to declare populated dictionary in swift 
Swift :: Swift Syntax of Nested Function 
Swift :: swift 5 cancel or end block operation 
Swift :: How to make dart typing stricter 
Swift :: declare empty dictionary in swift 
Ruby :: kill rails 
Ruby :: command to run all rspec tests 
Ruby :: how to check ruby version 
Ruby :: rspec add support folder to gem 
Ruby :: rails update without callback 
Ruby :: rails load environment variables 
Ruby :: how to write CSV file in rails 
Ruby :: ruby change directory 
Ruby :: ruby latest version 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =