"Go if"의 두 판 사이의 차이

 
22번째 줄: 22번째 줄:
</syntaxhighlight>
</syntaxhighlight>


==같이 보기=
==같이 보기==
* [[Go if else]]
* [[Go if else]]



2021년 11월 9일 (화) 17:21 기준 최신판

1 개요[ | ]

Go if
package main

import (
	"fmt"
	"math"
)

func sqrt(x float64) string {
	if x < 0 {
		return sqrt(-x) + "i"
	}
	return fmt.Sprint(math.Sqrt(x))
}

func main() {
	fmt.Println(sqrt(2), sqrt(-4))
}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}