answersLogoWhite

0

For loop can be used in following Ways:- Syntax: for var in list do commands done where list is basically the list of the values u want to traverse on, consider an example: suppose u want to display ur name 10 times we ca use for loop as: for var in 1 2 3 4 5 6 7 8 9 10 do echo "$name" done OR for var in {1 .. 10} do echo "$name" done OR the best way(analogous to c) for (( i = 0; i <= 10; i++) do echo "$name" done

User Avatar

Wiki User

17y ago

What else can I help you with?

Related Questions

What is the definition and syntax of for next loops?

loop within in a loop is called for next loop


What is the syntax for writing a loop in pseudo code?

The syntax for writing a loop in pseudo code typically involves using keywords like &quot;for&quot;, &quot;while&quot;, or &quot;do-while&quot; to indicate the type of loop, followed by the loop condition and the code block to be executed within the loop.


How do you create dummy file in unix?

using touch command of UNIX. syntax touch &lt;filename&gt; will create dummy regular file.


Syntax of for loop in c language?

for(i=0;i&lt;=0;i++)


Explain the use of chmod command in Unix with syntax?

To complex to answer completely here - see related link.


Is it possible to use a for loop in place of a while loop?

Yes. while loop consist of only condition statement to make for loop look as while loop we can use syntax shown below: for(;condition;) eg: for(;i&lt;=n;)


What is difference between select Case statement and nested loop in c programming in UNIX?

UNIX has no bearing on the C language; it is cross-platform. There is no select/case in C, you probably meant switch/case. However, a switch/case is a conditional jump while a nested loop is a loop within a loop. Besides the C language they have nothing in common with each other.


What is the difference between do while and for loop?

do { //statements }while(condition); The statements inside the block get executed at-least once, no matter what condition you have placed. Only from the 2nd time the condition is checked, simply because the condition is at the last. for(initialization; condition; updation) { //statements } Here the statements don't get executed even once if the condition fails initially. The condition is at the entry itself.


Is an infinite loop an example of a syntax error?

No. A syntax error is a statement that fails to compile. Infinite loops are simply loops for which the number of iterations is unknown. However, all loops, whether counted loops or infinite loops, must have a reachable exit condition. If a loop does not have a reachable exit condition then it is a logic error, not a syntax error.


What is the significance of write and talk command in UNIX?

About write Send a message to another user. Syntax write person [ttyname] About talk Talk with other logged in users. Syntax talk person [ttyname]


How do you use if statement syntax in a for loop?

You can use any number of if staments within a for-loop, eg: for (i=0; i&lt;10; ++i) { if (i=1) printf ("%d=1\n",i); }


What are while loop in vb.net?

The while loop in vb.net uses the syntax form which provides a way to continue iterating while one or more conditions are true.