program-flow Questions

12

Solved

One thing I've sometimes wondered is which is the better style out of the two shown below (if any)? Is it better to return immediately if a guard condition hasn't been satisfied, or should you only...
Calmas asked 28/5, 2010 at 11:31

8

Solved

I've seen this a lot: $fp = fopen($filepath, "w") or die(); But I can't seem to find any real documentation on this "or" syntax. It's obvious enough what it does, but can I use it anywhere? And mus...
Discus asked 2/3, 2012 at 14:51

1

Solved

How can I break out of the begin block and jump to the rescue block? def function begin @document = Document.find_by(:token => params[:id]) next if @document.sent_at < 3.days.ago # how ca...
Edwinedwina asked 9/1, 2014 at 21:8

1

Solved

This question is related to Javascript event handling and flow control, but it is one step beyond. The question that remains unanswered is: when an event is fired and control is returned to the bro...
Stunsail asked 1/6, 2012 at 9:59

2

Solved

This is perhaps a painfully basic question to answer, but I'm wondering about performance issues regarding using PHP's if identical !== versus if equal != to control flow. Consider the following t...

2

I copy a piece of code from SO as an example. The subroutine contains an error handler. Should one make an error handler for all Subs? Public Sub SubA() On Error Goto ProcError Connection.Open ...
Linear asked 27/5, 2011 at 7:42

3

Solved

This is what I'm doing now. Is there a better way to access the super class? public class SearchWidget { private void addWishlistButton() { final SearchWidget thisWidget = this; button.addClick...
Winola asked 18/5, 2010 at 15:19

3

Solved

I've been developing Web applications for a while now and have dipped my toe into GUI and Game application development. In the web application (php for me), a request is made to the file, that fil...
Diocletian asked 18/12, 2008 at 20:54
1

© 2022 - 2024 — McMap. All rights reserved.