Swift Study Notes (1): basics and basics of swift Study Notes

Source: Internet
Author: User

Swift study notes (1): basics, swift study notes basics

1. Constants & Variables

//constant
let constantsTeam = 1
//variable
var variablesTeam = 2
Use constants as much as possible, so that it is clearer and the memory is less prone to kidney loss.

2. Display / implicitly specified type

//Implicit
let inferredTeam = 3
// Explicit
let explicitTeam: Int = 4
Three, string output

// Use \ (variable or constant name) to refer to the combined string
println ("\ (inferredTeam) is bigger than \ (variablesTeam)!")
Four, classes and methods

// The class is declared with the class keyword
class TipCalculator {
 
  // Create attributes in the class
  let total: Double
  let taxPct: Double
  let subtotal: Double
 
  // The attribute must be given an initial value when it is declared, or in the initializer, otherwise it must be declared as optional (the initializer is used here)
  init (total: Double, taxPct: Double) {
    self.total = total
    self.taxPct = taxPct
    subtotal = total / (taxPct + 1)
  }
 
  // The method is declared using the func keyword and returns the Double type
  func calcTipWithTipPct (tipPct: Double)-> Double {
    return subtotal * tipPct
  }
 
  // no return value method
  func printPossibleTips () {
    println ("15%: \ (calcTipWithTipPct (0.15))")
    println ("18%: \ (calcTipWithTipPct (0.18))")
    println ("20%: \ (calcTipWithTipPct (0.20))")
  }
 
}
 
// Create a class instance object and call a method in the class through the class instance object
let tipCalc = TipCalculator (total: 33.25, taxPct: 0.06)
tipCalc.printPossibleTips ()
Five, arrays and loops

//1
let possibleTipsInferred = [0.15, 0.18, 0.20]
let possibleTipsExplicit: [Double] = [0.15, 0.18, 0.20]

//2
for possibleTip in possibleTipsInferred {
  println ("\ (possibleTip * 100)%: \ (calcTipWithTipPct (possibleTip))")
}
// 3
for i in 0 .. <possibleTipsInferred.count {
  let possibleTip = possibleTipsInferred [i]
  println ("\ (possibleTip * 100)%: \ (calcTipWithTipPct (possibleTip))")
}
Six, Dictionary

// 1
func returnPossibleTips ()-> [Int: Double] {
 
  let possibleTipsInferred = [0.15, 0.18, 0.20]
  let possibleTipsExplicit: [Double] = [0.15, 0.18, 0.20]
 
  // Create an empty dictionary
  var retval = Dictionary <Int, Double> ()
  for possibleTip in possibleTipsInferred {
    let intPct = Int (possibleTip * 100)
    // Assign to dictionary
    retval [intPct] = calcTipWithTipPct (possibleTip)
  }
  return retval
 
}
 

Seven


High school chemistry learning basic notes
Chapter 1 Learning Chemistry from Experiments
Section 1 Basic Methods of Chemical Experiment
1. In the chemical experiment, if the hands are accidentally stained with concentrated sulfuric acid, they should be washed immediately with plenty of water, and then coated with 3% to 5% NaHCO3; if accidentally dipped in caustic soda, they should be washed immediately with plenty of water, and then coated with boric acid solution; If the alcohol spilled on the desktop burns, it should be immediately covered with a damp rag or sand; mercury is sprayed on the desktop, which can be sprinkled with sulfur powder for recovery; if you eat heavy metal ions, you can take a lot of eggs, milk and other protein-containing foods for detoxification ; Ingesting barium salt solution by mistake, you can take Na2SO4 (not available Na2CO3) for detoxification. "Five preventions" should be done in the experiment: anti-explosion, anti-inhalation, anti-bump, anti-fire, anti-poisoning. Toxic and corrosive medicines must be handled with "three noes", that is, they must not touch the medicine with their hands, put their nostrils to the mouth of the container to smell the medicine, or taste the medicine. Common experiments that require water bath heating include: silver mirror reaction and ethyl acetate hydrolysis.
2. The vast majority of substances in nature exist in the form of mixtures. The operation of opening the components of the mixture is called separation of the mixture, and the operation of removing impurities contained in a substance is called purification.
3. The filtering operation is suitable for separating solid and liquid mixtures. The device used is called a filtering device. It is often assembled from a funnel, beaker, glass rod, iron stand, and filter paper. The assembly and operation of the device should be "one stick, two low and three lean", one stick: the filter paper is close to the inner wall of the funnel, the second is lower: the edge of the filter paper is lower than the edge of the funnel, the liquid level in the funnel is lower than the edge of the filter paper, three lean: The beaker is close to the glass rod, the glass rod is close to the three layers of filter paper, and the lower end of the funnel is close to the inner wall of the beaker receiving the filtrate.
4. The evaporation operation is suitable for the separation of soluble solid mixtures. The device used is called the evaporation device, which is generally assembled by instruments such as evaporating dish, iron stand, alcohol lamp, glass rod and so on. It should be noted that the liquid added to the evaporating dish should not exceed 2/3 of the volume of the evaporating dish; during the heating process, use a glass rod to continuously glue the rod to prevent the droplets from splashing due to the local high temperature; the heating should be stopped before it is evaporated to dryness , Using residual heat to evaporate the solvent.
5. Distillation operation is suitable for purifying or separating liquid mixtures with different boiling points. Write the name of each instrument in the device (number and name must correspond): ① alcohol lamp, ② distillation flask, ③ iron stand, ④ thermometer, ⑤ condensate tube, ⑥ tail pipe (horn tube), ⑦ Erlenmeyer flask, ⑧ asbestos network. The mercury ball of the thermometer in the device should be flush with the branch pipe of the distillation flask, and the temperature of the collected steam is measured to ensure the purity of the collected fraction; the condensed water enters and exits to achieve a good cooling effect; the flask is filled with rice The liquid should not exceed 2/3 of the container; check the airtightness of the device before use; add zeolite to the distillation flask during the experiment to prevent the liquid from boiling.
6. Liquid separation is the operation of separating two immiscible liquid mixtures. The main instruments used are: separatory funnel, auxiliary instruments also need beakers, glass rods. The upper liquid in the main instrument should be poured out from the upper port, and the lower layer liquid should be discharged from the lower port.
7. Extraction is the operation of extracting the solute from the solution composed of another solvent by using the difference of the solubility of the solute in the two solvents. The main instruments used are: separatory funnel, auxiliary instruments also need beakers, glass rods. Common extractants: gasoline (less dense than water), benzene (less dense than water), carbon tetrachloride (more dense than water).
8. Inspection of SO42-: Generally, HCl is added to the original sample for acidification, the purpose is to eliminate the interference of CO32-, SO32- plasma, and then BaCl2 solution is added to the acidified test solution. If there is white precipitation, it means that the original test solution There is SO42- there.
Cl-test: Generally, HCl is first added to the sample for acidification, the purpose is to eliminate the interference of CO32-, OH- plasma, and then AgNO3 solution is added to the acidified test solution, there is a white precipitate, indicating that the original test solution has Cl- exists.
CO32-test: adding HCl to the sample produces a colorless and odorless gas that can make the clarified Ca (OH) 2 turbid, indicating the presence of CO32- in the original test solution.
Section 2 Application of stoichiometry in experiments
1. The mass of any particle or substance is in grams. When the value is equal to the relative atomic mass or molecular mass of the particle, the number of particles contained is 6.02 × 1023. We counted the mass containing 6.02 × 1023 particles as 1 mole. Referred to as Mo, the symbol is mol. 6.02 × 1023mol-1 is called Avogadro's constant, the symbol is NA. The amount of matter actually represents a set of a certain number of shimmer particles ... the rest of the text >>
 
I do n’t know a lot of basic knowledge of physics, but I can understand it.

Learning physics is important, and mastering the methods of learning physics is more important. The "magic weapon" to learn physics well includes preview, lectures, sorting, application (homework), review summary, etc. A large number of facts show that: pre-class preparation is a prerequisite for learning physics; active and efficient listening is the key to learning physics; timely finishing study notes and doing exercises are to consolidate, deepen and activate the understanding of physics concepts, and transform knowledge into solutions The ability to solve practical problems, thus forming an important way of skills and skills; good at reviewing, summarizing and summarizing, can bypass the knowledge learned; appropriate reading of popular science books and participation in scientific and technological activities are useful supplements to learning physics; setting ambitious goals and doing well Full ideological preparation and maintaining a good learning attitude are the motivation and guarantee for learning physics well. Pay attention to learning methods and improve learning ability. Students can start from the following points. 1. Serious preview before class The preview is an important part of reading the teaching materials independently before class and acquiring new knowledge by yourself. To preview new lessons that have not been taught before the class, first read the contents of the new class carefully. Through reading, analyzing, and thinking, you can understand the knowledge system, key points, difficulties, scope, and requirements of the textbook. For physics concepts and laws, we must grasp the core, and the difference and connection with other physics concepts and laws, and record the difficult problems in the textbook that we do not understand. If you have forgotten the knowledge you have learned, you can make up for it during the preview before the class, so that you will not feel difficult during the class. Then look at the content of the new lesson, find out the relationship between the knowledge points, master the context of knowledge, and draw a schematic diagram of the knowledge structure. At the same time, you should also read the typical example questions and try to solve them. Take the post-answer questions as a check on the reading effect, and sum up the general ideas and steps to solve the problem. Competent students can also appropriately read extracurricular books of related content. Second, take the initiative to improve the efficiency of listening to lectures with pre-reading questions can improve the efficiency of listening to lectures, can make the focus of listening more prominent. In the classroom, when the teacher talked about what he did not understand during the preview, he was very active and paid special attention to listening, trying to understand in class. At the same time, you can compare the teacher's explanation to check the depth and breadth of your understanding of the textbook, learn the teacher's analysis process and thinking methods on difficult problems, and you can also make further doubts, analyze doubts, and put forward your own opinions. After listening to the class in this way, not only can you grasp the key points of knowledge, break through the difficulties, and grasp the key points, but also better master the teachers' ideas and methods for analyzing and solving problems, and further improve your learning ability. 3. Regularly organize the study notes. During the learning process, through the review of the learned knowledge, the comparison of preview notes, class notes, homework, compliance testing, textbooks and reference books and other materials to supplement and summarize, so that the knowledge learned reaches the system, Complete and highly summarized level. The study notes should be concise, easy to read, clear at a glance, and conform to your own characteristics. Make sure to classify the knowledge according to its own system on a regular basis and sort out summative study notes in order to systematize the knowledge. Save the results of these thoughts in time, and when you review later, you can quickly return to the height you once reached. If you believe in your memory and do n’t take notes when you are studying, you often ca n’t remember it when you use it. It ’s a pity! Fourth, do homework in time Homework is an indispensable part of learning physics knowledge, is the basic method of mastering knowledge proficiency skills. In the usual preview, use the exercises in the book to check the effect of your own preview. After the homework, perform one more problem and analyze the optimal solution exercises. In the chapter review, select the self-examination of extracurricular exercises, and provide timely feedback. Therefore, doing your homework carefully can deepen your understanding of what you have learned, discover the weak links in your knowledge and consciously strengthen it, gradually cultivate your ability to analyze and solve problems, and gradually build confidence in solving practical problems. To do a good job, we must first carefully examine the problem, clarify the physical process described in the problem, clarify the conditions given in the problem and the problem to be solved; choose the solution to the problem based on the physical phenomenon and process stated in the problem and the physics knowledge learned The physical concepts and laws used; after calm thinking or analytical reasoning, mathematical relationships are established; with the help of mathematical tools for calculation, the unit of each physical quantity should be unified into the international unit system when solving; finally, the answer must be verified and discussed To check whether the laws used are correct, whether the physical units appearing in the operation are consistent, whether the answer is correct and realistic, whether the physical meaning is clear, whether the calculation process is rigorous, and whether there are other solutions. Through verification of the answer and review In the process of solving problems, we can firmly grasp the knowledge, be familiar with various ideas and methods of solving problems, and improve the ability of solving problems. Fifth, review summary and improve learning ... the rest of the full text >>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.