MCQ Single Best Answer Easy

QWhere can variables be declared in X++?

ID: #9374 Module 12: X++ Overview 174 views
Question Info
#9374Q ID
EasyDifficulty
Module 12: X++ OverviewTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Only at the beginning of a method
  • B Only at the beginning of a class declaration
  • C Anywhere in the code (“in-line”)
  • D Anywhere within a form
Correct Answer: Option C

Explanation

Justification:

  1. Variables can be declared at the beginning of a method. However, they may be declared elsewhere as well.
  2. Variables may be declared at the beginning of a class declaration. However, they may be declared elsewhere as well.
  3. Variables can be declared anywhere in the code for small scopes. In-line variable declaration means you can declare and define the variable in a block of code as you plan to use it.
  4. Variables are not declared on forms themselves.

 

Related Lesson: Variable Declaration

Share This Question

Challenge a friend or share with your study group.