Foreach Loop
'foreach' is a looping attribute which is used to linearly iterate over String or List type values.
Syntax of 'on':
on : variable_name , value_to_iterate_onExamples:
Correct Syntax:
on : (Any val, [1,2,3,4])
or
on : (val, "Saksham Rapid Object Notation")
-----------------
Wrong Syntax:
@ 'on' attribute expects a String or List type of value
on : val, 1234
or
@ 'on' attribute doesn't require one variable and one value
on : ("SRON")Sample Code to iterate over list using foreach
OUTPUT :
Sample code to iterate over string using foreach
OUTPUT :
Last updated