DOORS DXL Scripting Examples – 1

/*
Write and test a script to do the following:

  • Declare variables to hold each value
  • Print the sum of 2 added to 40
  • Print the product of 1.4 multiplied by 83.7
    */
int  intFirstVal    = 2
int  intSecondValue = 40

real rlFirstVal  = 1.4
real rlSecondVal = 83.7

int  intTotal = intFirstVal + intSecondValue
real rlTotal  = rlFirstVal * rlSecondVal

print intTotal
print rlTotal

You could also implement in this way to make it more easy to maintain code –

int sumUp(int a, int b)
{
	int result = null
	result = a + b
	return result
}

print sumUp(2, 40)

real sumUp(real a, real b)
{
	real result = null
	result = a + b
	return result
} 

print sumUp(1.4, 83.7)

DOORS DXL Scripting Examples – 1
Scroll to top
error: Content is protected !!