본문 바로가기

전체 글345

[Go] Array An array is a collection of values all of which have the same type. The value that an array has is called an element. The syntax of array definition is following: var VARIABLE_NAME [NUMBER_OF_ELEMENTS]DATA_TYPE var numArr [3]int numArr[0] = 1 numArr[1] = 2 numArr[2] = 3 fmt.Println(numArr[0], numArr[1], numArr[2]) // 1 2 3 An array is static. Therefore, it is not possible to add a new element af.. 2021. 10. 10.
[Go] Control Flow Like the other languages, Go has a similar syntax for control flow. Conditional Statement if Statement if CONDITION { STATEMENTS } else if CONDITION { STATEMENTS } else { STATEMENTS } Definitely, you know, if statements are executed only if the conditions are true. else if and else statements can be omitted. In addition, if statement can be nested. package main import "fmt" func main() { score :.. 2021. 10. 10.
[Go] Constant A constant is an unchanged value. Only primitive type can be defined as constant. Boolean Rune Integer Real Number Complicated Number String The type that is not a primitive type like Structure, Array can't be defined as constant. Constant Definition const Name Type = Value If the name starts with a capital letter, the constant is exposed to out of the file. Constant Usage package main func main.. 2021. 10. 5.
[Go] The Error of Floating Point Number Like most programming languages, Go also has the floating point error problem. Problem Please look at the below code. package main import ( "fmt" ) func main() { a := 0.1 b := 0.2 c := a + b fmt.Println(c) } // 0.30000000000000004 c was not a 0.3! Therefore, we are hard to compare floating point numbers. a := 0.1 b := 0.2 c := 0.3 d := a + b if c == d { fmt.Println("It's the same!") } else { fmt.. 2021. 10. 4.
[Go] Operator Operator Precedence Unary operators have the highest precedence. As the ++ and -- operators form statements, not expressions, they fall outside the operator hierarchy. Go supports only post-increment and post-decrement operators, not pre-increment and pre-decrement. There are five precedence levels for binary operators. Binary operators of the same precedence associate from left to right. Preced.. 2021. 10. 4.
[Go] Package fmt Package fmt implements formatted I/O with functions analogous to C's printf and scanf. Description General %v : the value in a default format (when printing structs, adds the plus symbol to field names ) %#v : a Go-syntax representation of the value %T : a Go-syntax representation of the type of value Integer %b : base 2 %d : base 10 %x : base 16, with lower-case letters for a-f %X : base 16, wi.. 2021. 10. 4.
[VS Code] Extensions 추천 - (2021.09.17) 제가 현재 사용하는 것들 소개 및 추천 드려보고자 합니다. 저도 필요에 따라 골라 쓰고 있으니 맘에 드는 것들 골라 쓰시면 되요. ^^ Extensions 메뉴를 열려면 단축키(⇧⌘X)를 사용하시거나 좌측 메뉴에서 아이콘을 클릭하시면 되요. Appearance Material Theme 더보기 요 확장은 칼라 테마를 변경할 수 있게 해줍니다. ⌘K⌘T 키를 눌러 원하는 테마를 선택할 수 있습니다. 기분따라 쓸 때도 있고, 기본을 쓸 때도 있어요. 예전에 Vim이나 eclipse를 썼을 때는 좋아하는 테마가 있어서 그런 것들 사용하거나 직접 만들어 썼었는데... 지금은 그냥 기본이나 요 테마 를 번갈아가며 써요. Material Icon Theme 더보기 요 확장은 아이콘 테마를 변경할 수 있게 해줍니다... 2021. 9. 17.
[Svelte] Using TailwindCSS on Svelte TailwindCSS is my favorite CSS framework. Let's use TailwindCSS on Svelte. Create an Application Create a svelte application via a template. Please see Create an Application section on the below post. 2021.09.14 - [Web/Etc] - [Svelte] Getting Started with VSCode Add TailwindCSS Add dependencies for TailwindCSS. $ yarn add -D tailwindcss postcss autoprefixer or $ npm install -D tailwindcss postcs.. 2021. 9. 14.
[Svelte] Getting Started with VSCode Svelte is a framework that aims to "write less code", "no virtual dom", and "truly reactive". Therefore, the application code and result of svelte are simple and tiny. Create an Application Let's create a svelte application using the template. $ npx degit sveltejs/template getting-started Move to the application folder. $ cd getting-started Enable TypeScript. $ node scripts/setupTypeScript.js In.. 2021. 9. 14.