"카타 8급 Opposites Attract"의 두 판 사이의 차이

(새 문서: ==Kotlin== {{카타|8급|Kotlin|1}} <source lang='kotlin'> </source> <source lang='kotlin'> </source>)
 
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(다른 사용자 한 명의 중간 판 3개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==Kotlin==
==Kotlin==
{{카타|8급|Kotlin|1}}
{{카타|8급|Kotlin|1}}
<source lang='kotlin'>
<syntaxhighlight lang='kotlin'>
</source>
fun loveFun(flowerA: Int, flowerB: Int): Boolean {
<source lang='kotlin'>
    return ( flowerA%2 != flowerB%2 )
</source>
}
</syntaxhighlight>
<syntaxhighlight lang='kotlin'>
fun loveFun(flowerA: Int, flowerB: Int): Boolean = (flowerA + flowerB) %2 == 1
</syntaxhighlight>
 
==PHP==
{{카타|8급|PHP|2}}
<syntaxhighlight lang='php'>
function lovefunc($flower1, $flower2) {
  return $flower1%2 != $flower2%2;
}
</syntaxhighlight>
<syntaxhighlight lang='php'>
function lovefunc($flower1, $flower2) {
  return (bool) (($flower1 + $flower2) % 2);
}
</syntaxhighlight>

2020년 11월 2일 (월) 02:55 기준 최신판

1 Kotlin[ | ]

fun loveFun(flowerA: Int, flowerB: Int): Boolean {
    return ( flowerA%2 != flowerB%2 )
}
fun loveFun(flowerA: Int, flowerB: Int): Boolean = (flowerA + flowerB) %2 == 1

2 PHP[ | ]

function lovefunc($flower1, $flower2) {
  return $flower1%2 != $flower2%2;
}
function lovefunc($flower1, $flower2) {
  return (bool) (($flower1 + $flower2) % 2);
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}