In a Go program, you're tasked with calculating the area of a rectangle. You declare variables 'length' and 'width' to store the dimensions. Which keyword would you use to declare these variables?

  • const
  • let
  • var
  • variable
In Go, variables are declared using the 'var' keyword. Variables are used to store data that can change during the execution of the program. Therefore, for declaring 'length' and 'width' in this scenario, you'd use the 'var' keyword.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *