Skip to main content
Added alternate same-length alternate version
Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

PowerShell, 24 Bytes

param($a)do{$a}while($a)

Gets variable $a, then uses the do-whiledo-while loop functionality to output $a at least once, but continuing the loop if $a is truthy (i.e., 1).


Alternatively, using traditional while looping, also 24 bytes

param($a)while($a){$a}$a

In this instance, if $a is falsey, the while loop will never be executed and just the value of $a will be printed in the end statement. If $a is truthy, the program will enter the while loop and continuously print the value of $a.

PowerShell, 24 Bytes

param($a)do{$a}while($a)

Gets variable $a, then uses the do-while loop functionality to output $a at least once, but continuing the loop if $a is truthy (i.e., 1).

PowerShell, 24 Bytes

param($a)do{$a}while($a)

Gets variable $a, then uses the do-while loop functionality to output $a at least once, but continuing the loop if $a is truthy (i.e., 1).


Alternatively, using traditional while looping, also 24 bytes

param($a)while($a){$a}$a

In this instance, if $a is falsey, the while loop will never be executed and just the value of $a will be printed in the end statement. If $a is truthy, the program will enter the while loop and continuously print the value of $a.

Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

PowerShell, 24 Bytes

param($a)do{$a}while($a)

Gets variable $a, then uses the do-while loop functionality to output $a at least once, but continuing the loop if $a is truthy (i.e., 1).