Share
Go down
avatar
Admin
Posts : 42
Join date : 2018-07-24
Age : 20
Location : Dasmarinas City of Cavite
View user profilehttp://daniella.forumotion.asia

The FOR loop

on Fri Jul 27, 2018 6:45 pm
In addition to the while statement, most computer languages support a for statement. You usually use the for statement, or for loop, with definite loops—those that will loop a specific number of times when you know exactly how many times the loop will repeat.

for Statement Pseudocode Standards




The amount by which a for loop control variable changes is often called a step value. The step value can be any number and can be either positive or negative; that is, it can increment or decrement.

A for loop can express the same logic as a while statement, but in a more compact form. You never are required to use a for statement for any loop; a while loop can always be used instead. For example, to display Hello four times, you can write either of the sets of statements in Figure  BELOW.



Comparable while and for statements that each output Hello four times

The code segments, each accomplish the same tasks:
1.The variable count is initialized to 0.
2. The count variable is compared to the limit value 3; while count is less than or equal to 3, the loop body executes.
3. As the last statement in the loop execution, the value of count increases by 1. After the increase, the comparison to the limit value is made again.

A while loop can always be used instead of a for loop, but when a loop’s execution is based
on a loop control variable progressing from a known starting value to a known ending value in
equal steps, the for loop provides a convenient shorthand.
Guru
Posts : 11
Join date : 2018-07-28
View user profile

Re: The FOR loop

on Sat Jul 28, 2018 4:13 pm
Maam Ano po ang pinagkaiba sa paggamit ng For, If and While ? study Surprised
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Sat Jul 28, 2018 7:30 pm
As long sa Structured tingnan yung flowchart . Possible na pwede yung For Loop inside a while loop or vice versa Smile @yagi tapos sa pseudo code naman . I think makikita mo naman agad if may For loop sa loob ng while loop kasi naka indent siya . @brix . Yun lang sa opinyon ko hehe 😊

Sent from Topic'it App
avatar
Guru
Posts : 12
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 5:12 pm
Maam ang dami ko pong natutunan sa forum nyo, sayang lang at huli na para itama ko yung sinagot ko dun sa quiz hehehe Sad

Sent from Topic'it App
Posts : 2
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 6:52 pm
This forum helped me a lot understanding the FOR loop, thank you for creating this
Guru
Posts : 11
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 7:46 pm
Kaya nga po example po medyo naguguluhan po kasi ako sa for loop
avatar
Guru
Posts : 12
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 7:48 pm
Sa next discussion yan maraming example si maam Smile Hahaha

Sent from Topic'it App
Guru
Posts : 11
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 7:51 pm
Yung for loop po ba isang beses lang pwede gamitin sa isang program? Wala po kasing sample nya
Guru
Posts : 10
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 7:54 pm
Ma'am pwede pa po ba kayo magbigay ng ibang examples po? Medyo nagugulumihanan po ako ee
avatar
Guru
Posts : 12
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 7:59 pm
Sana marami din ako knowledge kagaya ng mga knowledge nyo sa coding at stuff mga cm at maam hehehe, di ko magets ibang mga tanong dito e whahahaha.. Pero laking tulong po nitong forum Smile

Sent from Topic'it App
Guru
Posts : 11
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 8:05 pm
Mam pwede po bang gawing sentinel value yung module?
Sa module ko po kasi nandoon po yung list ng mga product kumbaga data base. Kaya gagawin ko po syang sentinel value if ever wala po sya doon sa list magtatype po ulit ng panibago pwede po ba? Kung hindi ano po suggestion nyo?
Natanong lang sensya na po wala pang alam sa mga ganyan

Guru
Posts : 11
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 8:06 pm
Mam kapag while loop po ba laging (<>)not equal gagamitin?

Guru
Posts : 11
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 8:08 pm
Kapag for loop naman po may required comparison po ba sya or wala?
Guru
Posts : 11
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 8:09 pm
Mam sa ginawa po naming flowchart sa time
Paano po mapapabalik sa input na equals to 0 para maging 00 po yung seconds nya at hindi maging 61,62....
Guru
Posts : 11
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 8:36 pm
Mam kung yung while loop is may loop control variable sa for loop po meron din po ba?
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 9:25 pm
@airojames . Regarding dun sa tanong mo (Comment #16) . Sa pagkaka intindi ko . Yung While Loop at For Loop . Same sila na may Control Variable Smile

Sent from Topic'it App
Moderator
Posts : 6
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 9:31 pm
mam ano po yung step value siya ba yung nagse2t kung magiincrease yung value at magde2crease?
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 9:34 pm
airojames wrote:Mam sa ginawa po naming flowchart sa time
Paano po mapapabalik sa input na equals to 0 para maging 00 po yung seconds nya at hindi maging 61,62....
Siguro yung pwede ka maglagay ng process after ng loop sa sec na pwede makakapag balik sa zero yung sec. example kapag naka 60 na sec kana after nun diretso na siya sa ginawa mong proces na yung min. + 1 tapos yung 60 - 60 para 0 na ulit yung sec.

Sent from Topic'it App
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 9:46 pm
airojames wrote:Yung for loop po ba isang beses lang pwede gamitin sa isang program? Wala po kasing sample nya
Pwede naman siguro more than one kasi parehas sa while loop pwede mo ka gumamit ng while loop ng more than one .ganun din siguro sa for loop kasi same logic lang naman sila ng statement tsaka if nalilito padin sa for loop di naman siya required na siya talaga yung gagamitin lang . pwede naman na while loop nalang gamitin kasi mas madali siya intindihin at gawin Smile

Sent from Topic'it App
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 9:51 pm
ALEXIS_GAMING wrote:Ma'am pwede pa po ba kayo magbigay ng ibang examples po? Medyo nagugulumihanan po ako ee
ako din pre eh 😂 pero mas maganda padin if while loop nalang gamitin pre . mas madali intindihin tsaka gawin

Sent from Topic'it App
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 9:53 pm
Sean wrote:
ALEXIS_GAMING wrote:Ma'am pwede pa po ba kayo magbigay ng ibang examples po? Medyo nagugulumihanan po ako ee
ako din pre eh 😂 pero mas maganda padin if while loop nalang gamitin pre . mas madali intindihin tsaka gawin

*while statement rather

Sent from Topic'it App
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 10:07 pm
Base sa tanong ni @Rheign . Sa pagkaka intindi ko yung if statement it's either mameet niya yung condition or hindi, magtutuloy lang siya pero yung while statement at for statement naman if hindi niya mameet yung condition uulit lang siya or mag lo.loop siya hanggang sa ma meet na niya yung condition . sana tama haha 😂

Sent from Topic'it App
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 10:10 pm
michael jhon wrote:mam ano po yung step value siya ba yung nagse2t kung magiincrease yung value at magde2crease?
Oo pre siya yung mag se.set kung either magiincrease or magde.decrease yung value na gusto mo ma meet sa condition mo . Sa tingin ko ...

Sent from Topic'it App
Guru
Posts : 10
Join date : 2018-07-31
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 10:59 pm
Sa pagkakaintindi ko ang for at while parehas lng nmn ng gamit. Pero kung gusto mong mas maging maikli yung pseudo mo gamit ka ng for.
Guru
Posts : 15
Join date : 2018-07-27
View user profile

Re: The FOR loop

on Tue Jul 31, 2018 11:02 pm
Emie Laide wrote:Sa pagkakaintindi ko ang for at while parehas lng nmn ng gamit. Pero kung gusto mong mas maging maikli yung pseudo mo gamit ka ng for.
Lodi HAHAHA 😂😂😂 .

Sent from Topic'it App
Sponsored content

Re: The FOR loop

Back to top
Permissions in this forum:
You cannot reply to topics in this forum