The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
returning values (return command)
RaideX Offline
Member

Posts: 212
Threads: 33
Joined: May 2013
Reputation: 7
#1
returning values (return command)

hello again,

could someone maybe explain and declare me what the return function in some instances do excectly?

All i know is that return "returns" a value and ends a function. But in an amnesia example there are only void datatypes for functions (atleast most of the time). So what excectly would be the difference between the following two if statements and how/when would they be used?

PHP Code: (Select All)
void function (string &in asParentstring &in asChildint alState) {
if (
alState == 1) {
PlaySoundAtEntity(""sound.snt"Player"0false);
return; }

if (
alState == -1) {
PlaySoundAtEntity(""sound2.snt"Player"0false); 
return; }


PHP Code: (Select All)
void function (string &in asParentstring &in asChildint alState) {
if (
alState == 1) {
PlaySoundAtEntity(""sound.snt"Player"0false);
}

if (
alState == -1) {
PlaySoundAtEntity(""sound2.snt"Player"0false); 
}


If you don't draw first, you don't get to draw at all... -The False Shepherd
01-02-2014, 07:35 PM
Find


Messages In This Thread
returning values (return command) - by RaideX - 01-02-2014, 07:35 PM
RE: returning values (return command) - by RaideX - 01-02-2014, 09:56 PM
RE: returning values (return command) - by Javist - 01-03-2014, 09:34 AM



Users browsing this thread: 1 Guest(s)