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 @bennetthunter10:

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

124 active golfers, 375 entries

Solutions by @bennetthunter10:
22
#52 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:30PM

22
#>52 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:31PM

24
#>62 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:30PM

26
#>80 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:29PM

27
#>82 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:28PM

28
#>87 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:24PM

29
#>95 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:23PM

30
#>98 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:22PM

34
#>117 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:22PM

35
#>118 - Bennett Hunter / @bennetthunter10

07/10/2026 at 09:19PM