Programming beginners are learning by themselves. Since it is in a state of groping, there may be a lot of things to do.
As I proceeded with learning, when I expanded the learning language, I thought that even if I had done it in the past, the grammar would be confused and I would often search again, so it is rudimentary. I decided to leave it as my own memo even if it was something.
Java
for (Preparation of variables; Repeat condition; Update of variables)
qiita.java
for(int i = 0; i < 5; i++) {
System.out.println(i); //processing
}
=>
1
2
3
4
5
for (Preparation of type variable: Array to be processed)
qiita.java
String[] team = {"Brave", "Warrior"}
for(String member : team) {
System.out.println(member); //processing
}
=>
Brave
Warrior
Ruby
for variable in number of iterations
qiita.rb
for i in 1..5
puts i
end
=>
1
2
3
4
5
Number of times .times do
qiita.rb
5.times do
puts "Repeat"
end
=>
Repeat
Repeat
Repeat
Repeat
Repeat
Recommended Posts