๐Ÿ‘ฉ๐Ÿป‍๐Ÿ’ป iOSun
article thumbnail
[Swift Language Guide] ๋ฌธ์ž์—ด๊ณผ ๋ฌธ์ž (Strings and Characters)
Swift Language Guide 2023. 5. 16. 22:15

// ๋ฌธ์ž์—ด ๋ฆฌํ„ฐ๋Ÿด์— ํŠน์ˆ˜ ๋ฌธ์ž let sparklingHeart = "\\u{1F496}" // ๐Ÿ’–, Unicode scalar U+1F496 // ๋ฌธ์ž์—ด ๋ณ€๊ฒฝ var variableString = "Horse" variableString += " and carriage" // "Horse and carriage" ๋ฌธ์ž์—ด์€ ๊ฐ’(value) ํƒ€์ž…์ด๋‹ค. ์›๋ณธ์ด ์•„๋‹Œ ์ƒˆ๋กœ์šด ๋ณต์‚ฌ๋ณธ์ด ์ „๋‹ฌ๋œ๋‹ค. ์œ ๋‹ˆ์ฝ”๋“œ (Unicode) ์ธ์ฝ”๋”ฉ, ํ‘œ๊ธฐ, ๊ทธ๋ฆฌ๊ณ  ๋‹ค๋ฅธ ์“ฐ๊ธฐ ์‹œ์Šคํ…œ์—์„œ์˜ ํ…์ŠคํŠธ ํ”„๋กœ์„ธ์‹ฑ์„ ์œ„ํ•œ ๊ตญ์ œ ํ‘œ์ค€์ด๋‹ค. Swift์˜ String ๊ณผ Character ํƒ€์ž…์€ ์œ ๋‹ˆ์ฝ”๋“œ๋ฅผ ์™„๋ฒฝํ•˜๊ฒŒ ์ง€์›ํ•œ๋‹ค. Swift์˜ ๊ธฐ๋ณธ String ํƒ€์ž…์€ ์œ ๋‹ˆ์ฝ”๋“œ ์Šค์นผ๋ผ ๊ฐ’ (Unicode scalar values) ์œผ๋กœ๋ถ€ํ„ฐ ์ƒ์„ฑ var ..

article thumbnail
[Swift Language Guide] ๊ธฐ๋ณธ ์—ฐ์‚ฐ์ž (Basic Operators)
Swift Language Guide 2023. 5. 16. 22:12

๋Œ€์ž… ์—ฐ์‚ฐ์ž (Assignment Operator) if x = y { // ํ‹€๋ฆฐ ๋ฌธ๋ฒ•, ๋Œ€์ž… ์—ฐ์‚ฐ์ž๋Š” ๊ฐ’์„ ๋ฆฌํ„ดํ•˜์ง€ ์•Š์Œ } ์‚ฐ์ˆ  ์—ฐ์‚ฐ์ž (Arithmetic Operators) 1 + 2 // equals 3 5 - 3 // equals 2 2 * 3 // equals 6 10.0 / 2.5 // equals 4.0 ๊ฐ’์ด ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋˜๋Š” ๊ฒƒ์„ ํ—ˆ๋ฝํ•˜์ง€ ์•Š์Œ ๋‚˜๋จธ์ง€ ์—ฐ์‚ฐ์ž (Remainder Operator) -9 % 4 // -9 = (4*-2) + (-1) a = (b x some multiplier) + remainder ๊ณ„์‚ฐ์‹์œผ๋กœ ๋‚˜๋จธ์ง€ ๊ณ„์‚ฐ ๋‹จํ•ญ ๋บ„์…ˆ ์—ฐ์‚ฐ์ž (Unary Minus Operator) & ๋‹จํ•ญ ๋ง์…ˆ ์—ฐ์‚ฐ์ž (Unary Plus Operator) // ๋‹จํ•ญ ๋บ„์…ˆ ์—ฐ์‚ฐ์ž let th..

article thumbnail
[Swift Language Guide] ๊ธฐ๋ณธ (The Basics)
Swift Language Guide 2023. 5. 16. 22:09

์ดˆ๋ฐ˜์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์•„๋Š” ์ง€์‹์€ ๊ฐ„๋‹จํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๊ฑฐ๋‚˜ ํŒจ์Šคํ•˜๊ณ  ์ƒˆ๋กญ๊ฒŒ ์•Œ๊ฒŒ ๋œ ์ง€์‹ ์œ„์ฃผ๋กœ ์ •๋ฆฌํ•ด ๋ณด๋ ค ํ•ฉ๋‹ˆ๋‹ค! ์ƒ์ˆ˜์™€ ๋ณ€์ˆ˜ (Constants and Variables) let maximumNumberOfLoginAttempts = 10 // ์ƒ์ˆ˜ -> ๊ฐ’ ๋ณ€๊ฒฝ ๋ถˆ๊ฐ€๋Šฅ var currentLoginAttempt = 0 // ๋ณ€์ˆ˜ -> ๊ฐ’ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅ var x = 0.0, y = 0.0, z = 0.0 ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์ƒ์ˆ˜ ๋˜๋Š” ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•  ๋•Œ, ํ•œ ์ค„๋กœ ์„ ์–ธ์ด ๊ฐ€๋Šฅํ•˜๋‹ค. let input = readLine()!.split(separator: " ").map { Int(String($0))! } let height = input[0], width = input[1], k = input[2] ๊ฐœ์ธ์ ์œผ๋กœ ์•Œ๊ณ ๋ฆฌ์ฆ˜..

profile on loading

Loading...