์๋ฐ ์ธ์ด๋ก ์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ ๋ฅผ ํ ๋, ๋ฌธ์ ์์ ์ฃผ์ด์ง ์
์ถ๋ ฅ ์กฐ๊ฑด์ ๋ง์ถ๊ธฐ ์ํด ๋ฌธ์ ๋ง๋ค ๋ฐ๋ณต์ ์ผ๋ก ์ด๋ค ๊ฐ์ ์
๋ ฅ๋ฐ๋ ์ฝ๋๋ฅผ ์์ฑํด์ผ ํ๋ค. ๋๋ ์ฒ์์๋ ๊ทธ๋ฅ ๋ด๊ฐ ์๊ณ ์๋ Scanner์ System.out.println()์ ํ์ฉํด์ ์
์ถ๋ ฅ ๋ถ๋ถ ์ฝ๋๋ฅผ ์์ฑํ๋ค.๊ทธ๋ฐ๋ฐ ๊ตฌ๊ธ๋ง์ ํ๋ค ๋ณด๋๊น ๋ณดํต์ StringBuilder์ BuffererdReader๋ฅผ ๋ง์ด ์ฌ์ฉํ๊ธธ๋ ๋ ์ฐพ์๋ณธ ๊ธฐ๋ก์ ๋จ๊ฒจ๋ณธ๋ค. ๋จผ์ , ์ถ๋ ฅ ๋ถ๋ถ์ ๋ณด์.๋๋ ๋ญ๊ฐ์ ๊ฒฐ๊ด๊ฐ์ ๋ฐ๋ณตํด์ ์ถ๋ ฅํด์ผ ํ ๋, ๊ทธ๋ฅ ๋ฐ๋ณต๋ฌธ์์ System.out.println()์ ๋๋ ธ์๋ค.๊ทธ๋ฐ๋ฐ ์
์ถ๋ ฅ ์์
์ ๊ต์ฅํ ๋๋ฆฌ๊ณ ์์ ์๋ชจ๊ฐ ํฌ๊ธฐ ๋๋ฌธ์, ์ด๋ ๊ฒ ํ์ง ๋ง๊ณ ๋ชจ๋ ์ถ๋ ฅํ ๊ฐ๋ค์ ํ๋์ ๋ฌธ์์ด๋ก ๋ง๋ค์ด์ค ๋ค, ๊ทธ ๊ฐ์ ํ ๋ฒ์ ์ถ๋ ฅํ๋ ๋ฐฉ์์ด ๋ ..
๐ฌ Programming Language

์ ๋๊ฐ๋ vsc์์ ๊ทธ๋ฅ print()๋ก ์ฐ์ด๋ณด๋ฉด ๋๊ฐ๊ฒ ๋์จ๋ค. ๊ทธ๋์ ์ฃผํผํฐ๋ก ํด๋ด ํ์์ ์ฅ์ ์ ์ ๋ ๊ฒ ์์ผ๋ก์ ์ ๋ฆฌ์คํธ ๋ฉ์ด๋ฆฌ๋ฅผ ๋ฌธ์์ด ํ๋๋ก ๋ณผ ์ ์์. ๋ฌธ์ ๊ฐ์์ธ๊ธฐ ๋ฌธ์ ์์ ํ์ฉ ๊ฐ๋ฅ #1~10000์์ ์ซ์ 8์ด ๋ฑ์ฅํ๋ ๊ฐ์ ์ธ๊ธฐ(8808์ +3๊ฐ) # ๋ฐฉ๋ฒ1 print(str(list(range(1, 10001))).count('8')) # ๋ฐฉ๋ฒ2 count = 0 for i in range(1, 10001): if '8' in str(i): count += str(i).count('8') print(count) # ๋ฐฉ๋ฒ3 print(str([i for i in range(1, 10001)]).count('8'))
let something = "Something";let result = null;function foo () { if (something === "Something") { result = "Is something"; } var something = "Else";}foo();console.log(result)if (result === null) { alert("๐");}let something = "Something";let result = null;function foo () { if (something === "Something") { result = "Is something"; } // var something = "Else";}foo();console.log(res..
Global Variable ์ฌ์ฉํ๊ธฐ์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ ๋ฅผ ํ๋ค๊ฐ ๋ฐ๊ฒฌํ.. function์์์ global variable์ฌ์ฉํ๋ ๋ฐฉ๋ฒ๋๋ ์ธ ์๊ฐ๋ ๋ชปํ๋๊ฑฐ๋ผ ํ๋ฒ ์ ๋ฆฌํด๋๊ณ ๋์ด๊ฐ๋ฉด ๋ค์์ ์ฐ๊ฒ ์ง ์ถ์ด์ ์ ๋ฆฌํด๋ณธ๋ค.์ ์ญ๋ณ์๊ฐ ๋ฌด์์ธ์ง ์ด๋ป๊ฒ ์ฐ๋์ง๋ ์ ์๋ ์ฝ๋์ w3schools์ ๊ธ์ ์ฐธ๊ณ ํ๋ฉด ๋๋๊น๋ฐ๋ก ์ ๋ฆฌํ์ง ์์๊ฑฐ๊ณ ์ด๋ป๊ฒ ๋ฌธ์ ์์ ์ผ๋์ง๋ง ๊ฐ๋ตํ ๊ธฐ๋กํด๋ณผ๋ ค๊ณ ํ๋ค.def turn_left(): global direction direction -= 1 if direction == -1: direction = 3๋ฐฉํฅ์ค์ ->์ด๋ ๋ฌธ์ ์ ํ์์ ๋ฐฉํฅ์ ํ ๊ธฐ๋ฅ ๊ตฌํ์ ์ํด ํจ์๋ฅผ ๋ง๋ฆ๋ฐฉํฅ์ ๋ฐ๋ฅธ ์ด๋๋์ dx, dy๋ผ๋ ๋ ๊ฐ์ ๋ฆฌ์คํธ๋ฅผ ๋ง๋ค์ด์ ๊ด๋ฆฌํจ๊ฐ direction์..

Function Definition // example String sayHello(String potato){ return "hi $potato"; } String sayHello(String potato) => "hi $potato"; // fat arrow syntax Parameters Named Parameters // String hi({String name, int age, String country}){ // ์ด๋ ๊ฒ๋ง ํ๋ฉด, ์ฌ์ฉ์๊ฐ arg๋ฅผ ์ ๋ถ ์ ๋ฌํ์ง ์์ ์๋ ์์.->๊ทธ๋ฆฌ๊ณ ํจ์ ๋ด์์ ์ฐธ์กฐํ๋ฉด null์ฐธ์กฐ์. // ๋ฐ๋ผ์ dart์์ error๋ก ์ก์์ค //String hi({String name='jin', int age=1, String country='k'}){ // ํด๊ฒฐ๋ฐฉ..
Dart์๋ String, bool, int, double๋ฑ์ ๊ธฐ๋ณธ ์๋ฃํ์ด ์๊ณ , ์๋ค๋ dart์์ ๊ฐ์ฒด๋ก ์ ์๋์ด ์๋ค. Lists void main(){ var num = true; var numbers = [1, 2, 3, 4, if(num) 5,]; // ์ง์ญ๋ณ์๋ var๋ก ์ ์ธํ๋๊ฒ ๊ถ์ฅ๋๋ค๊ณ ํ๋ค! // List numberss = [1, 2, 3, 4]; // ๋ง์ง๋ง์์ ์ถ๊ฐํ๋ ์กฐ๊ฑด๊ณผ ๊ฐ์ ์๋ฏธ... collection if if (num) { numbers.add(5); } } ์์ฃผ ๋ง์ ํ๋กํผํฐ, ๋ฉ์๋๊ฐ ์์ collection if ๊ธฐ๋ฅ์ ์ฌ์ฉํด ์กด์ฌํ ์๋์ํ ์๋์๋ ์์๋ฅผ ๊ฐ์ง๊ณ list๋ฅผ ๋ง๋ค ์ ์์. String Interpolation text์ ๋ณ์๋ฅผ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ ๋ณ..
Final Variables javascript์ const์ same ์ฌ์ฉ ์์ ์ฐธ๊ณ final String ๋ณ์ API์ ์์ฒญ ๋ณด๋ด๊ณ => API์์ ๊ฐ์ ๋ณด๋ด์ฃผ๋ฉด => late๋ณ์์ ๋ฃ์ Constant Variables dart์ const๋ javascript์ const์ ๋ค๋ฆ. ์ด๊ฒ์ ์๊น ๋งํ final๊ณผ ์ ์ฌ dart์์์ const๋ compile-time constant๋ฅผ ๋ง๋ค์ด์ค๋ค. ์ปดํ์ผ ํ๊ธฐ ์ ์(compile-time) ์ด๋ฏธ ์๊ณ ์๋(์ ํด์ง) ์์๊ฐ์ ์ ์ฅํ ๋ ์ฌ์ฉํจ but) apiํต์ ์ ํตํด ๋ฐ์์์ผํ๋ ๊ฐ์ด๋, ์ฌ์ฉ์๊ฐ ํ๋ฉด์์ ์
๋ ฅํด์ผ ํ๋ ๊ฐ์ด๋ผ๋ฉด ๊ทธ ๊ฐ์ final ๋๋ var๊ฐ ๋ฐ์์ผ ํ๋ค. ์ฑ์์ ์ฌ์ฉ๋ ์์๋ค์ const๋ฅผ ์ฌ์ฉํ ์ ์์. ex) conat m..

๋ชฐ๋๋ ๋ด์ฉ ๋๋ ํ๋ฒ ๋ ์ ๋ฆฌํ๊ณ ์ถ์ ๋ด์ฉ๋ค๋ง ์์ฑํ๋ค. Main Function ๋ชจ๋ dartํ๋ก๊ทธ๋จ์ entry point์ ๋ชจ๋ ์ฝ๋์ mainํจ์๊ฐ ์์ด์ผ ํจ. js๋ ts๋ auto formatter๊ฐ ;๋ฅผ ์ฝ์
ํด์ฃผ์ง๋ง, dart๋ ์ํด์ค ์ด์ : ๋คํธ์์๋ ์ผ๋ถ๋ฌ ์ธ๋ฏธ์ฝ๋ก ์ ์์ธ๋๊ฐ ์๊ธฐ ๋๋ฌธ์ด๋ค. ์ด์ฉ์ง.....์๋๋๋ผ...์ต์คํ
์
๋๋ฌธ์ธ์ค๋ก๋ง์์๋๋ฐ ์๋์์ด..๋คํธ์ cascade operator ๊ธฐ๋ฅ ๋๋ฌธ์ด๋ผ๊ณ ํจ The Var Keyword ๋คํธ์์ ๋ณ์๋ฅผ ๋ง๋๋ ๋ฐฉ๋ฒ 1: var ํค์๋ ์ฌ์ฉํ๊ธฐ ์ปดํ์ผ๋ฌ๊ฐ ์ด์ฐจํผ ๊ทธ ๋ณ์๊ฐ String์ธ ๊ฒ์ ์ void main(){ var name = '์ง๋'; // dart๊ฐ ์๋ฃํ์ ์ถ์ธกํด์ ์ง์ ํด์ค name = 1; // ์๋จ. ๋ณ์๋ฅผ ์์ ํ ..
Dart๋ Typed Language์ด๋ค. ์ด๋ค ํ๋์ ์ธ์คํด์ค์ type์ ๊ทธ๊ฒ์ ํด๋์ค์ด๋ค. Constructor ์ดํดํ๊ธฐ ๋คํธ์ ์์ฑ์๋ ์๋ฐ์ธ์ด์ ๋๊ฐ์ ๊ฐ๋
์ด๋ค. ์ธ์คํด์ค๋ฅผ ์ด๊ธฐํํ๊ธฐ ์ํด ์ฌ์ฉ๋๋ ๋ฉ์๋์ด๊ณ , ํด๋์ค๋ ๋ฐ๋์ ์์ฑ์๊ฐ ํ์ํ๋ค ๋ฑ,,, ๋น์ทํจ ๊ฐ์ ํ(ํด๋์ค)๋ก ์ฐ์ด๋์ผ๋๊ฐ ๊ตฌ์กฐ๋ ๊ฐ๋๋ผ๋ ๊ฐ ํน์ง๊ฐ์ ๋ค๋ฅธ ์ธ์คํด์ค๋ฅผ ๋ง๋ค์ด๋ด๊ธฐ ์ํ ํจ์๋ค ๋ผ๊ณ ์๊ฐํ์ ์ด์ ๊ฐ๋จํ ์ฝ๋๋ฅผ ๋ด
์๋ค. class Student{ String name = 'jiny'; int age = 21; void sayhi(){ print("hi my name is $name"); } } void main(){ var student = Student(); print(student..
Q3: Insect CombinatoricsConsider an insect in an M by N grid. The insect starts at the bottom left corner, (1, 1), and wants to end up at the top right corner, (M, N). The insect is only capable of moving right or up. Write a function paths that takes a grid length and width and returns the number of different paths the insect can take from the start to the goal. (There is a closed-form solution..