개 한놈은 산책가자고 얼굴 핥아대고
개 다른 한놈은 코로 문열고 들어와서 굴러 다니지도 못하게 하고 -_-
'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글
| 주말이 짧다 (0) | 2024.02.25 |
|---|---|
| 으윽 비가 온다. (0) | 2024.02.18 |
| 애견놀이터 민원은 실패 (0) | 2024.02.03 |
| 상병발생원인 신고서? (2) | 2024.02.02 |
| 온천 다녀옴 (0) | 2024.01.28 |
개 한놈은 산책가자고 얼굴 핥아대고
개 다른 한놈은 코로 문열고 들어와서 굴러 다니지도 못하게 하고 -_-
| 주말이 짧다 (0) | 2024.02.25 |
|---|---|
| 으윽 비가 온다. (0) | 2024.02.18 |
| 애견놀이터 민원은 실패 (0) | 2024.02.03 |
| 상병발생원인 신고서? (2) | 2024.02.02 |
| 온천 다녀옴 (0) | 2024.01.28 |
switch로 두가지 형태가 존재하는데
하나는 일반적인 변수에 대한 분기를 처리하는 것이고
| switch variable { case variable_type_value : } |
다른 하나는 switch의 탈을 쓴 if문?
| switch { case statement: } |
혼합해서 해보니
statement 쪽에서 숫자를 int 형으로 변환할 수 없다고 에러가 발생한다.
| switch variable { case variable_type_value : case statement: } |
| golang runtime.GOMAXPROCS() (0) | 2024.02.15 |
|---|---|
| golang echo 템플릿 파일로 불러오기 (0) | 2024.02.14 |
| golang switch - fallthrough (0) | 2024.02.08 |
| golang break, continue 라벨 그리고 goto (0) | 2024.02.08 |
| golang import (0) | 2024.02.07 |
어우.. 키워드 긴것 보소 -_-
fallthrough 하면 c에서 break 없이 case를 붙이면 조건 비교는 없이 다음 case를 실행했었는데
golang 에서도 조건을 보진 않고 그냥 다음 문장을 수행한다.
다만 가장 마지막 case에는 당연히(?) fallthrough를 넣으면 에러가 발생한다.
| package main import "fmt" func main() { i := 45 switch { case i < 10: fmt.Println("i is less than 10") fallthrough case i < 50: fmt.Println("i is less than 50") fallthrough case i < 100: fmt.Println("i is less than 100") } } |
| Output i is less than 50 i is less than 100 |
[링크 : https://golangbyexample.com/fallthrough-keyword-golang/]
[링크 : https://pyrasis.com/book/GoForTheReallyImpatient/Unit19/02]
| golang echo 템플릿 파일로 불러오기 (0) | 2024.02.14 |
|---|---|
| golang switch (0) | 2024.02.08 |
| golang break, continue 라벨 그리고 goto (0) | 2024.02.08 |
| golang import (0) | 2024.02.07 |
| golang iota (0) | 2024.02.07 |
어우.. 문법이 이해하기 좀 빡세네?
c에서 goto는 해당 위치로 간다는게 직관적이었지만 golang에서 break, continue는 딱 와닫지 않는다.
특히나 예제에서 2중 루프를 돌리면 해당 라벨로 점프하는 느낌이 아니라
nested loop만 빠져나가는 것 같은데 어떻게 이해해야하려나?
반대로.. 해당 루프를 continue 하는거니까, 내부 loop를 break 하는걸로 이해하면 되나?
| var err error timeout := time.After(30 * time.Second) sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, os.Interrupt) complete := make(chan error) go launchProcessor(complete) Loop: for { select { case <-sigChan: atomic.StoreInt32(&shutdownFlag, 1) continue case <-timeout: os.Exit(1) case err = <-complete: break Loop } } return err |
| guestList := []string{"bill", "jill", "joan"} arrived := []string{"sally", "jill", "joan"} CheckList: for _, guest := range guestList { for _, person := range arrived { fmt.Printf("Guest[%s] Person[%s]\n", guest, person) if person == guest { fmt.Printf("Let %s In\n", person) continue CheckList } } } |
[링크 : https://www.ardanlabs.com/blog/2013/11/label-breaks-in-go.html]
[링크 : https://pyrasis.com/book/GoForTheReallyImpatient/Unit17/01]
goto는 한 함수 내에서 label이 유효하여 아래와 같이 다른 함수를 넘나들순 없게 구성되었다고 한다.
c와의 차이점이라고 해야하나..
| package main import "fmt" func main() { learnGoTo() } func learnGoTo() { fmt.Println("a") goto FINISH fmt.Println("b") } func test() { FINISH: fmt.Println("c") } |
[링크 : https://golangbyexample.com/goto-statement-go/]
[링크 : https://pyrasis.com/book/GoForTheReallyImpatient/Unit18]
| golang switch (0) | 2024.02.08 |
|---|---|
| golang switch - fallthrough (0) | 2024.02.08 |
| golang import (0) | 2024.02.07 |
| golang iota (0) | 2024.02.07 |
| golang echo session check (0) | 2024.02.06 |
golang 에서 import시 _는 써봤는데, .이랑 별칭은 첨 본 듯..
. 은 namespace(?)가 꼬일수 있으니 주의해서 쓰라고 한다.
| import _ "time" import . "time" import t "time" |
[링크 : https://go.dev/doc/effective_go#package-names]
[링크 : https://knight76.tistory.com/entry/go-lang-import-별명-alias]
| golang switch - fallthrough (0) | 2024.02.08 |
|---|---|
| golang break, continue 라벨 그리고 goto (0) | 2024.02.08 |
| golang iota (0) | 2024.02.07 |
| golang echo session check (0) | 2024.02.06 |
| golang echo template engine (0) | 2024.01.31 |
iota는 매우 적은 양이라는 뜻이라는데..
[링크 : https://www.etymonline.com/kr/word/iota]
c의 enum 형에서 0부터 시작할때 첫 변수에 iota로 할당하면 된다.
[링크 : https://go.dev/wiki/Iota]
| golang break, continue 라벨 그리고 goto (0) | 2024.02.08 |
|---|---|
| golang import (0) | 2024.02.07 |
| golang echo session check (0) | 2024.02.06 |
| golang echo template engine (0) | 2024.01.31 |
| gin ui (0) | 2024.01.30 |
| spring 다시 시작 (0) | 2020.01.15 |
|---|---|
| spring boot 어플리케이션 로그 0:0:0:0:0:0:0:1 (0) | 2020.01.13 |
| jsoup html body 사이즈 제한 (0) | 2019.09.26 |
| java 메모리 관련...2? (0) | 2019.07.06 |
| java.lang.OutOfMemoryError: GC overhead limit exceeded (1) | 2019.07.06 |
_로 자릿수를 표현할 수 있다는걸 처음 알았다
[링크 : https://cotnmin.dev/4]
[링크 : https://www.javascripttutorial.net/es-next/javascript-numeric-separator/]
| qr decoder part 2 (0) | 2024.04.07 |
|---|---|
| javascript groupby map (0) | 2024.03.12 |
| 마우스로 테이블 열 변경하기 (0) | 2024.02.02 |
| html video 재생종료 event (0) | 2023.09.02 |
| 숫자에 콤마 찍기(자릿수 표현) (0) | 2023.07.27 |
erase block 단위로 정렬하면 좋다는데 그걸 어떻게 확인하지?
데이터시트 안보고 리눅스 레벨에서 확인할 순 없나?
| Try to align to eMMC erasure block size. It usually equals 0.5, 1, 2, 4, 8 MiB depending on eMMC datasheet. If you find block size alignment too much memory wasting, then stick to the page size, generally found in the range of 4..16 KiB. |
[링크 : https://unix.stackexchange.com/questions/248939/how-to-achieve-optimal-alignment-for-emmc-partition]
| SVE(Scalable Vector Extension) (0) | 2025.08.28 |
|---|---|
| arm asm rev (0) | 2023.09.14 |
| cortex-a53 (0) | 2023.08.31 |
| aarch64 vector register (0) | 2023.08.23 |
| arm vsub operator (0) | 2023.08.09 |
| golang import (0) | 2024.02.07 |
|---|---|
| golang iota (0) | 2024.02.07 |
| golang echo template engine (0) | 2024.01.31 |
| gin ui (0) | 2024.01.30 |
| golang swagger part 2 (0) | 2024.01.18 |