Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 9v006715b7d2000000000535

Fix the Scala Method

Fix the missing semicolons and the Int type, ensure the floating point division, and remove the unnecessary return.

Start file
def calculateTotalPrice(items List[Double], discountPercentage int): Double = {
  val subtotal = items.sum
  val discountAmount = subtotal * (discountPercentage / 100)
  val total = subtotal - discountAmount
  return total
}
End file
def calculateTotalPrice(items: List[Double], discountPercentage: Int): Double = {
  val subtotal = items.sum
  val discountAmount = subtotal * (discountPercentage / 100.0)
  val total = subtotal - discountAmount
  total
}

View Diff

1c1
< def calculateTotalPrice(items List[Double], discountPercentage int): Double = {
---
> def calculateTotalPrice(items: List[Double], discountPercentage: Int): Double = {
3c3
<   val discountAmount = subtotal * (discountPercentage / 100)
---
>   val discountAmount = subtotal * (discountPercentage / 100.0)
5c5
<   return total
---
>   total

Solutions by @skywalkerwhack:

Unlock 11 remaining solutions by signing in and submitting your own entry
Created by: @pacuna

109 active golfers, 332 entries

Solutions by @skywalkerwhack:
22
#49 - skywalkerwhack / @skywalkerwhack

04/11/2026 at 05:07PM

22
#>49 - skywalkerwhack / @skywalkerwhack

04/11/2026 at 05:16PM

24
#>56 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:46PM

25
#>62 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:43PM

26
#>72 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:40PM

27
#>74 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:37PM

28
#>79 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:34PM

30
#>87 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:29PM

39
#>105 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:29PM

41
#>105 - skywalkerwhack / @skywalkerwhack

04/09/2026 at 01:26PM

135
#>109 - skywalkerwhack / @skywalkerwhack

04/11/2026 at 05:13PM