Files
freeCodeCamp/guide/russian/swift/functions/index.md
2018-10-16 21:32:40 +05:30

15 lines
1001 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Functions
localeTitle: функции
---
## функции
Функции в Swift состоят из параметра и типа возврата. Функции могут быть созданы с использованием этой базовой структуры: \`\` \`Swift func sayHello (nameOfPerson: String) -> String { let hello = "Hello", + nameOfPerson + "." печать (привет) }
sayHello (nameOfPerson: «Стив») ` `` In this example, the function sayHello takes in a string name and prints out the phrase` «Hello, Steve.» \`.
## Параметры функции
Функции не требуют ввода входных параметров или возвращаемых типов. Однако для этого требуются скобки после именования функций. \`\` \`Swift func helloSteve () { print («Привет, Стив»). }
helloSteve () // Это выдает «Привет, Стив». \`\` \`