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

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
21번째 줄: 21번째 줄:
}
}
</syntaxhighlight>
</syntaxhighlight>
==같이 보기=
* [[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 =같이 보기

2.1 참고

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