Sha256: 3ec5900f8a0e3dc717b5498bf436470c352b5dead248e491bded0a4c8005d531
Contents?: true
Size: 1.73 KB
Versions: 8
Compression:
Stored size: 1.73 KB
Contents
!2 Variables are always passed "by reference" and not "by value" if a variable is changed on a sub page and then referenced again on the parent page the variable has the value assigned on the sub page and not the value from the parent page. This behaviour is shown in the below examples: !3 Define initial values for numerator, denominator and quotient !define numerator {10} !define denominator {1} !define quotient {${= %3.0f : ${numerator} / ${denominator} =}.0} !define quotient2 quotient !include >VariablesRedefinedMultipleTimesOnSamePageAndUsedInSubpage !3 Check values from variables and symbols |script| | #| $ {numerator} has the value as defined on this page| |check | echo | ${numerator} | 10 | | #| $ {denominator} has the value as defined on the sub page| |check | echo | ${denominator} | 2.5 | | #| $ {quotient4} has the value from expression on the sub sub page| |check | echo | ${quotient4} | 4.0 | | #| $ {result} has the value as defined on the sub sub page| |check | echo | ${result} | 77.0 | |#| $ result Symbol from sub sub page can be accessed| |check | echo | $result | 4.0| !3 Redefine numerator !define numerator {20} !include >VariablesRedefinedMultipleTimesOnSamePageAndUsedInSubpage !3 Check values from variables and symbols again |script| | #| $ {numerator} has the value as defined on this page| |check | echo | ${numerator} | 20 | | #| $ {denominator} has the value as defined on the sub page| |check | echo | ${denominator} | 2.5 | | #| $ {quotient4} has the value from expression on the sub sub page| |check | echo | ${quotient4} | 8.0 | | #| $ {result} has the value as defined on the sub sub page| |check | echo | ${result} | 77.0 | |#| $ result Symbol from sub sub page can be accessed| |check | echo | $result | 8.0|
Version data entries
8 entries across 8 versions & 1 rubygems