Learn R Programming

player (version 0.1.0)

play_coin_flip: Flip a coin

Description

Flip a coin

Usage

play_coin_flip(
  n = NULL,
  animate = rlang::is_interactive(),
  header = rlang::is_interactive()
)

Value

A character vector of "heads" or "tails" results.

Arguments

n

How many coins to flip. Defaults to NULL, which interactively asks how many to flip.

animate

If TRUE, play an animation before revealing the result. Defaults to TRUE if the session is interactive and FALSE otherwise.

header

If TRUE, prints a header for the game. Defaults to TRUE if the session is interactive and FALSE otherwise.

Examples

Run this code
play_coin_flip(1)

if (rlang::is_interactive()) play_coin_flip()

Run the code above in your browser using DataLab