Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Default Arguments in Action | Writing Functions in R
Functions and Functional Programming in R

bookChallenge: Default Arguments in Action

Uppgift

Swipe to start coding

Write a function rectangle_area that calculates the area of a rectangle, with the height defaulting to 1 if not provided.

  • The function must take two parameters: width and height, with height defaulting to 1.
  • The function must return the product of width and height.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 6
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

bookChallenge: Default Arguments in Action

Svep för att visa menyn

Uppgift

Swipe to start coding

Write a function rectangle_area that calculates the area of a rectangle, with the height defaulting to 1 if not provided.

  • The function must take two parameters: width and height, with height defaulting to 1.
  • The function must return the product of width and height.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 6
single

single

some-alt