Skip to main content
5 of 12
deleted 9 characters in body
roblogic
  • 4k
  • 18
  • 23

Fortran (GFortran) -cpp, 409 389 383 341 bytes

#define q(z)trim(z)
character(16)a,b,c,w,x
a=' bottles of beer';b=a;c=' bottle of beer';w=' on the wall'
do i=99,1,-1
write(x,*)i;x=adjustl(x);if(i<2)b=c
print*,q(x),q(b),q(w),', ',q(x),q(b),'.'
if(i>1)print*,'Take one down, pass it around, ',q(x),q(b),q(w),'.',new_line(x)
enddo
print*,"Go to the store and buy some more, 99",a,q(w),"."
end

Try it online!

The -cpp option allows me to #define a helper macro. Maybe one day Fortran will have stretchy strings but for now I have to use trim() everywhere.
Confession: the latest version (341b) is CoPilot assisted.

roblogic
  • 4k
  • 18
  • 23