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

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

98 active golfers, 306 entries

Solutions by @GavinKoeng:
22
#43 - Gavin / @GavinKoeng

11/25/2025 at 05:08PM

24
#>53 - Gavin / @GavinKoeng

11/25/2025 at 05:08PM

26
#>68 - Gavin / @GavinKoeng

11/25/2025 at 05:06PM

27
#>69 - Gavin / @GavinKoeng

11/25/2025 at 05:04PM

28
#>74 - Gavin / @GavinKoeng

11/25/2025 at 05:03PM

28
#>74 - Gavin / @GavinKoeng

11/25/2025 at 05:04PM

30
#>80 - Gavin / @GavinKoeng

11/25/2025 at 05:02PM

34
#>94 - Gavin / @GavinKoeng

11/25/2025 at 05:00PM

38
#>96 - Gavin / @GavinKoeng

11/25/2025 at 02:14PM

40
#>96 - Gavin / @GavinKoeng

11/25/2025 at 09:57AM

44
#>97 - Gavin / @GavinKoeng

11/25/2025 at 04:56PM

84
#>98 - Gavin / @GavinKoeng

11/25/2025 at 02:13PM