Post History
Java (JDK), 51 50 23 21 bytes x->y->x==y&y==2?5:x+y Try it online! Golfed 27 bytes thanks to @Moshi's advice. Golfed 2 bytes thanks to @user's advice on Discord.
Answer
#5: Post edited
- # [Java (JDK)], <s>51</s> <s>50</s> <s>23</s> 21 bytes
- <!-- language-all: lang-java -->
- x->y->x==y&y==2?5:x+y
- [Try it online!][TIO-kuvcg8wh]
Golfed 27 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4840#comment-14340). Golfed a byte thanks to [**@user**](https://codegolf.codidact.com/users/53837)'s advice on Discord.- [Java (JDK)]: http://jdk.java.net/
- [TIO-kuvcg8wh]: https://tio.run/##jc49D4IwEAbgmf6KTgaiNIK6iK2biYMTo3Fo@EoRCikHoTH89toYdJXtTe55767kA/fL9GmEhEzlPMnwjQv5Qhh3wEEkuLSC9CAqkvcyAdFIcpnD6WpLRaY2y9AcGMM5pmb0mfbZSKleaUrD8@E4rrWJHDTfHRqR4tr@4saghCzuD8xV0Xkv5Dix7iCrSdMDae0MKunmhLdtpd3Q@wUvWkh3f@l@@dZg@7XBx05oMm8 "Java (JDK) – Try It Online"
- # [Java (JDK)], <s>51</s> <s>50</s> <s>23</s> 21 bytes
- <!-- language-all: lang-java -->
- x->y->x==y&y==2?5:x+y
- [Try it online!][TIO-kuvcg8wh]
- Golfed 27 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4840#comment-14340). Golfed 2 bytes thanks to [**@user**](https://codegolf.codidact.com/users/53837)'s advice on Discord.
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kuvcg8wh]: https://tio.run/##jc49D4IwEAbgmf6KTgaiNIK6iK2biYMTo3Fo@EoRCikHoTH89toYdJXtTe55767kA/fL9GmEhEzlPMnwjQv5Qhh3wEEkuLSC9CAqkvcyAdFIcpnD6WpLRaY2y9AcGMM5pmb0mfbZSKleaUrD8@E4rrWJHDTfHRqR4tr@4saghCzuD8xV0Xkv5Dix7iCrSdMDae0MKunmhLdtpd3Q@wUvWkh3f@l@@dZg@7XBx05oMm8 "Java (JDK) – Try It Online"
#4: Post edited
# [Java (JDK)], <s>51</s> <s>50</s> 23 bytes- <!-- language-all: lang-java -->
(x,y)->x==y&y==2?5:x+y;[Try it online!][TIO-kutdl4wl]Golfed 27 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4840#comment-14340).- [Java (JDK)]: http://jdk.java.net/
[TIO-kutdl4wl]: https://tio.run/##XY1PS8QwEMXP7acYFpTUZoMIe7GbXfAgePC0R/UQ@4/JtklppkuD9LPX1C4KHuY93sxvZrS6qK0uzjO2ne0JdMhiIGxENZic0Bpxl8Xd8NlgDnmjnINXhQa@4ujadKQo2MViAW0YsRP1aOq3D1B97ZKFjJ7w@Xpt/2KorMue//MDVCBhZiP3yfYwSulvvZQPx93jmPpsjqLK9sDQEGDg7rNge9gFS9P1xR@gV0CvgP4FopN3VLbCDiQC3Cpim5sCUggig7ybDQfkoDlUQnVd49mSkiRbtqf4p6Z4mr8B "Java (JDK) – Try It Online"
- # [Java (JDK)], <s>51</s> <s>50</s> <s>23</s> 21 bytes
- <!-- language-all: lang-java -->
- x->y->x==y&y==2?5:x+y
- [Try it online!][TIO-kuvcg8wh]
- Golfed 27 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4840#comment-14340). Golfed a byte thanks to [**@user**](https://codegolf.codidact.com/users/53837)'s advice on Discord.
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kuvcg8wh]: https://tio.run/##jc49D4IwEAbgmf6KTgaiNIK6iK2biYMTo3Fo@EoRCikHoTH89toYdJXtTe55767kA/fL9GmEhEzlPMnwjQv5Qhh3wEEkuLSC9CAqkvcyAdFIcpnD6WpLRaY2y9AcGMM5pmb0mfbZSKleaUrD8@E4rrWJHDTfHRqR4tr@4saghCzuD8xV0Xkv5Dix7iCrSdMDae0MKunmhLdtpd3Q@wUvWkh3f@l@@dZg@7XBx05oMm8 "Java (JDK) – Try It Online"
#3: Post edited
# [Java (JDK)], <s>51</s> 50 bytes- <!-- language-all: lang-java -->
static int f(int x,int y){return x==y&y==2?5:x+y;}[Try it online!][TIO-kuta6k7i]- [Java (JDK)]: http://jdk.java.net/
[TIO-kuta6k7i]: https://tio.run/##fYyxDoIwFEVn@IpOpo2VCOoiafwCJ0bj0EAhBSmmPEibhm@vxbjKcoZ7cm7LZ35oq85LBULXvBTozqVyfgQOskRhRjVeaehKS5wWMGmFDGN2ZxnLbper2dt88dGvmQdZoT684AK0VM3jibhuRuLiKCrsCKJPhgmSd3DwUrjGGc0Iyf/b04Y9b7bpkaZfvcSL/wA "Java (JDK) – Try It Online"
- # [Java (JDK)], <s>51</s> <s>50</s> 23 bytes
- <!-- language-all: lang-java -->
- (x,y)->x==y&y==2?5:x+y;
- [Try it online!][TIO-kutdl4wl]
- Golfed 27 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4840#comment-14340).
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kutdl4wl]: https://tio.run/##XY1PS8QwEMXP7acYFpTUZoMIe7GbXfAgePC0R/UQ@4/JtklppkuD9LPX1C4KHuY93sxvZrS6qK0uzjO2ne0JdMhiIGxENZic0Bpxl8Xd8NlgDnmjnINXhQa@4ujadKQo2MViAW0YsRP1aOq3D1B97ZKFjJ7w@Xpt/2KorMue//MDVCBhZiP3yfYwSulvvZQPx93jmPpsjqLK9sDQEGDg7rNge9gFS9P1xR@gV0CvgP4FopN3VLbCDiQC3Cpim5sCUggig7ybDQfkoDlUQnVd49mSkiRbtqf4p6Z4mr8B "Java (JDK) – Try It Online"
#2: Post edited
# [Java (JDK)], 51 bytes- <!-- language-all: lang-java -->
static int f(int x,int y){return x==y&&y==2?5:x+y;}[Try it online!][TIO-kut9t01n]- [Java (JDK)]: http://jdk.java.net/
[TIO-kut9t01n]: https://tio.run/##fYyxDoIwFEXn8hWdSBsrEdRF0vgFTozGoYGWFKWY8iA0hG@vxbjKcoZ7cm4jRrFvqqfXBqRVopT4JrSZfQ8CdInDjBVZObGVjs5WwmANnjh3cew4z67ny7Rz@eLRLxo7XeE23JACrDb1/YGFrXs6RwgVrgfZJt0AyTs4eBmiSMYySvP/9rhhT5ttemDpVy/R4j8 "Java (JDK) – Try It Online"
- # [Java (JDK)], <s>51</s> 50 bytes
- <!-- language-all: lang-java -->
- static int f(int x,int y){return x==y&y==2?5:x+y;}
- [Try it online!][TIO-kuta6k7i]
- [Java (JDK)]: http://jdk.java.net/
- [TIO-kuta6k7i]: https://tio.run/##fYyxDoIwFEVn@IpOpo2VCOoiafwCJ0bj0EAhBSmmPEibhm@vxbjKcoZ7cm7LZ35oq85LBULXvBTozqVyfgQOskRhRjVeaehKS5wWMGmFDGN2ZxnLbper2dt88dGvmQdZoT684AK0VM3jibhuRuLiKCrsCKJPhgmSd3DwUrjGGc0Iyf/b04Y9b7bpkaZfvcSL/wA "Java (JDK) – Try It Online"
#1: Initial revision
# [Java (JDK)], 51 bytes <!-- language-all: lang-java --> static int f(int x,int y){return x==y&&y==2?5:x+y;} [Try it online!][TIO-kut9t01n] [Java (JDK)]: http://jdk.java.net/ [TIO-kut9t01n]: https://tio.run/##fYyxDoIwFEXn8hWdSBsrEdRF0vgFTozGoYGWFKWY8iA0hG@vxbjKcoZ7cm4jRrFvqqfXBqRVopT4JrSZfQ8CdInDjBVZObGVjs5WwmANnjh3cew4z67ny7Rz@eLRLxo7XeE23JACrDb1/YGFrXs6RwgVrgfZJt0AyTs4eBmiSMYySvP/9rhhT5ttemDpVy/R4j8 "Java (JDK) – Try It Online"